Localhost:8080 in nextjs with railway deployment
lokeshahire
FREEOP

7 months ago

I have deploying Next.js apps on Railway. However, I have encountered an unusual error in this particular project. In the route handler, the URL from the request object returns "localhost" instead of the configured domain.
while deploying in vercel it was wroking fine but in railway deployment redreicting to 8080 localhost for some pages

$10 Bounty

5 Replies

lokeshahire
FREEOP

7 months ago

N/A


lokeshahire
FREEOP

7 months ago

Project ID: N/A


lokeshahire
FREEOP

7 months ago

I have deploying Next.js apps on Railway. However, I have encountered an unusual error in this particular project. In the route handler, the URL from the request object returns "localhost" instead of the configured domain.
while deploying in vercel it was wroking fine but in railway deployment redreicting to 8080 localhost for some pages


noahd
EMPLOYEE

7 months ago

https://github.com/vercel/next.js/discussions/34571 I'd take a look here. Might have to do with things being a forwarded port


longbuivan
HOBBY

7 months ago

I think this is because hard code of your code base. Have you try to redirect with condition? Like add Env = production vs env = local. Then add env ib railway?


Loading...