From e357d68f1fd02171aeb0a26d94bd46d1ea47e807 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Mon, 16 Sep 2024 12:19:13 +0200 Subject: [PATCH] Add CORS header to redirect response To fix usage of redirecting URL (no trailing slash) in OpenRefine --- app/controllers/HomeController.java | 2 +- conf/routes | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/HomeController.java b/app/controllers/HomeController.java index 52f2d42..55c5998 100644 --- a/app/controllers/HomeController.java +++ b/app/controllers/HomeController.java @@ -117,7 +117,7 @@ public static String configNested(String id, String sub) { * @return A 301 MOVED_PERMANENTLY redirect to the path */ public Result redirectSlash(String path) { - return movedPermanently("/" + path); + return movedPermanently("/" + path).withHeader("Access-Control-Allow-Origin", "*"); } public Result index() { diff --git a/conf/routes b/conf/routes index fa82439..657d57e 100644 --- a/conf/routes +++ b/conf/routes @@ -3,7 +3,7 @@ # ~~~~ #OpenRefine reconciliation endpoint -GET /gnd/reconcile controllers.Default.redirect(to = "/gnd/reconcile/") +GET /gnd/reconcile controllers.HomeController.redirectSlash(path = "gnd/reconcile/") POST /gnd/reconcile controllers.Reconcile.reconcile() GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "") POST /gnd/reconcile/ controllers.Reconcile.reconcile()