Skip to content

Commit

Permalink
fix(redirect): app.use => app.get
Browse files Browse the repository at this point in the history
app.use applies to all requests that match a given path, including
requests to subpaths. This results in redirects for URLs that are
incorrect, including `/short-url/unwanted/path`.

Correct this by specifying that only GETs to short URL paths should
be handled.
  • Loading branch information
LoneRifle committed Aug 19, 2020
1 parent afedeea commit 38a1e10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ initDb()
'/assets/transition-page/js/redirect.js',
redirectController.gtagForTransitionPage,
)
app.use(
app.get(
'/:shortUrl([a-zA-Z0-9-]+)',
...redirectSpecificMiddleware,
redirectController.redirect,
Expand Down

0 comments on commit 38a1e10

Please sign in to comment.