From 9c0a888d117b4fd9c47aca1601892416a25ea6d1 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 26 Sep 2018 17:02:04 +0100 Subject: [PATCH] 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