502 errors with Cloudflare proxy and custom domain
bhrugu-scientist
HOBBYOP

a year ago

My Next.js application running on Railway is experiencing 502 Bad Gateway errors when accessed through Cloudflare.

  • Issue: Cloudflare returns '502 Bad Gateway' with error 'failed to forward request to upstream: connection refused'
  • My app works fine on the Railway-provided URL (noshu-production.up.railway.app)
  • I have set up CNAME records in Cloudflare.
  • My app is running on port 3000 with a custom domain (nosh.network)
  • Railway shows 'Cloudflare proxy detected' in domain settings

Could this be a configuration issue on Railway's side with handling Cloudflare proxied connections?

1 Replies

reid
PRO

7 months ago

Same issue here exactly


Welcome!

Sign in to your Railway account to join the conversation.

Loading...