Skip to content

Fix nginx upstream resolution for backend proxy#20

Merged
rcjasub merged 1 commit into
mainfrom
railway/code-change-eQ1Eo3
Apr 24, 2026
Merged

Fix nginx upstream resolution for backend proxy#20
rcjasub merged 1 commit into
mainfrom
railway/code-change-eQ1Eo3

Conversation

@railway-app

@railway-app railway-app Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Problem

Nginx fails to start with "host not found in upstream "backend.railway.internal"" because proxy_pass ${BACKEND_URL} causes nginx to resolve the upstream hostname eagerly at startup, before Railway's internal DNS is ready.

Solution

Added set $backend_url ${BACKEND_URL}; inside both the /api and /socket.io location blocks and changed proxy_pass to use $backend_url. When proxy_pass receives a variable instead of a literal URL, nginx skips the startup-time DNS resolution and resolves the hostname on each request, by which point the internal Railway DNS is available.

Changes

  • Modified my-app/nginx.conf

Generated by Railway

@vercel

vercel Bot commented Apr 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
free-form-code Ready Ready Preview, Comment Apr 24, 2026 4:29am

@rcjasub rcjasub merged commit 7b6500e into main Apr 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant