WebSocket upgrade requests return 400 via Railway edge, but succeed when hitting the container directly
jumple86
HOBBYOP

a month ago

WebSocket upgrade requests to our backend fail with 400 Bad Request when going through Railway's edge proxy (server: railway-hikari), on both our custom domain and the Railway-provided *.up.railway.app domain. The exact same request succeeds with 101 Switching Protocols when sent directly to the container, bypassing Railway. We've confirmed our own nginx and backend configs are correct via direct bypass testing — the edge appears to be dropping the Connection: Upgrade / Upgrade: websocket headers before the request reaches our container.

  • Project ID: 5b60aae3-5313-4c5d-9bd3-a3710caa77ad
  • Environment ID: a39f92f2-5c36-4519-8404-d2595a5c8365
Solved$10 Bounty

3 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 1 month ago


a month ago

Could you provide a MRE in a public repo to help debug this? WS upgrades through the Railway edge are working fine on my end.


milo

Could you provide a MRE in a public repo to help debug this? WS upgrades through the Railway edge are working fine on my end.

jumple86
HOBBYOP

a month ago

Thanks for looking into this — we managed to resolve it on our end before you got a chance to dig in, so no need to spend more time on it.

For the record, in case it's useful for your internal tracking: the WebSocket upgrade failures were isolated to our custom domain (tripways.org) specifically — the exact same service worked correctly for WS

upgrades via its Railway-provided *.up.railway.app domain the whole time. Removing the custom domain from the service and re-adding it (which triggered a fresh DNS verification + edge routing binding) fixed it.

This matches the pattern described in another Station thread we came across (custom-domain-on-healthy-service-returns-2adc2de8) — sounds like custom domain edge routing bindings can end up in a stale/broken

state independent of the underlying service's health, and re-adding the domain forces a clean rebind.

We put together a minimal reproduction while debugging this, in case it's useful for your team to understand the shape of the issue: https://github.com/Jumple86/railway-ws-upgrade-mre

Thanks again for the platform — appreciate the quick response!


a month ago

glad you got it working!


Status changed to Solved milo about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...