handling invalid routes / redirect logic
janezkk
PROOP

5 months ago

Hi team,

On VPS + Nginx, we could catch malformed URLs like:

domain.com/%list

Nginx would intercept this and throw an appropriate error or allow us to redirect to a valid URL.

After moving to Railway, the same URL now returns:

ERR_HTTP2_PROTOCOL_ERROR

We want to intercept these invalid routes and redirect to a valid URL, since some users already have this wrong link.

You can reproduce with the demo project: https://nextjs-test-production-2df7.up.railway.app/%product-list/0/50

$20 Bounty

7 Replies

5 months ago

I just get a 404 when visiting that link


janezkk
PROOP

5 months ago

It appears that Discord encodes the URL as %25 when the link is clicked. Please try copying and pasting the URL manually

https://nextjs-test-production-2df7.up.railway.app/%product-list/0/50


5 months ago

Ah gotcha, I assume our proxy is the thing that is throwing the error.


janezkk
PROOP

5 months ago

yes, but do we have any solutions?


5 months ago

Not from a platform side of things; I'll let the community make suggestions.


janezkk
PROOP

5 months ago

ok, thanks


fra
HOBBYTop 5% Contributor

5 months ago

you could probably add Nginx in front of your app (but that will probably increase the cost), or handle the redirects in your app?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...