Can’t reach Next.js service from other containers using internal URL (only works with public URL)
pbird
HOBBYOP

3 months ago

I’m running a project on Railway with three services: Next.js, NestJS, and Nginx.

I’m facing an issue where I cannot reach my Next.js server from other services using the internal URL. If I use the public URL, everything works fine, but internal connections fail.

  • When I try to reach Next.js from Nginx, I get a 502 Gateway Error.

  • I tested my Nginx configuration and it looks correct.

  • When I curl from inside another container, the request succeeds with the public domain, but fails with the internal hostname/URL.

I’m using the official Next.js Docker template from Vercel:

https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile

It seems like the Next.js container isn’t accessible internally, only externally through Railway’s public proxy.

Solved

1 Replies

Railway
BOT

3 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Status changed to Solved pbird 3 months ago


Loading...