From 9c0a888d117b4fd9c47aca1601892416a25ea6d1 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 26 Sep 2018 17:02:04 +0100 Subject: [PATCH 1/3] Add custom redirect for /docs We want to redirect POST and GET to different locations, but this is unsupported by RedirectManager. Therefore we redirect GETs with RedirectManager and POSTs with this custom route. --- services/web/app/coffee/router.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index ac0889d0c4..8c22edae5d 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -330,6 +330,12 @@ module.exports = class Router AuthenticationController.httpAuth, CompileController.getFileFromClsiWithoutUser + # We want to redirect POST and GET to different locations, but this is + # unsupported by RedirectManager. Therefore we redirect GETs with + # RedirectManager and POSTs with this custom route + publicApiRouter.post '/docs', (req, res, next) -> + res.redirect(307, "#{Settings.apis.v1.url}/docs") + webRouter.get '/teams', (req, res, next) -> # Match v1 behaviour - if the user is signed in, show their teams list # Otherwise show some information about teams From f2fa83a218b42542f98e39e8f5f2924306acc570 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 26 Sep 2018 17:03:48 +0100 Subject: [PATCH 2/3] Fix /teams redirect using wrong setting --- services/web/app/coffee/router.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index 8c22edae5d..1e30460193 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -342,7 +342,7 @@ module.exports = class Router if AuthenticationController.isUserLoggedIn(req) res.redirect('/user/subscription') else - res.redirect("#{settings.v1Api.host}/teams") + res.redirect("#{settings.apis.v1.url}/teams") webRouter.get '/chrome', (req, res, next) -> # Match v1 behaviour - this is used for a Chrome web app From c2ecccfa02d5fffbc6f5f943b5948c20528662ad Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 26 Sep 2018 17:35:51 +0100 Subject: [PATCH 3/3] Use correct setting --- services/web/app/coffee/router.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index 1e30460193..2c7e7ec8b2 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -334,7 +334,7 @@ module.exports = class Router # unsupported by RedirectManager. Therefore we redirect GETs with # RedirectManager and POSTs with this custom route publicApiRouter.post '/docs', (req, res, next) -> - res.redirect(307, "#{Settings.apis.v1.url}/docs") + res.redirect(307, "#{Settings.overleaf.host}/docs") webRouter.get '/teams', (req, res, next) -> # Match v1 behaviour - if the user is signed in, show their teams list @@ -342,7 +342,7 @@ module.exports = class Router if AuthenticationController.isUserLoggedIn(req) res.redirect('/user/subscription') else - res.redirect("#{settings.apis.v1.url}/teams") + res.redirect("#{settings.overleaf.host}/teams") webRouter.get '/chrome', (req, res, next) -> # Match v1 behaviour - this is used for a Chrome web app