Cloud flare 502

jaliljzarifa
PRO

8 days ago

Hi there, I have recently added a new domain to my backend. After completing the necessary configurations, it says Cloudflare proxy detected. However, after trying to use my site as usual, I am getting Bad gateway Error code 502 visit cloudflare.com.

Is this temporary? How do I fix this situation? If temporary, how long does it last ususally?

Solved$10 Bounty

7 Replies

Railway
BOT

8 days 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!


jaliljzarifa
PRO

8 days ago

These do not really help. I have changed the domain. I just want to confirm that it is just to do with waiting and not with my configurations or something.
CNAME
@

gzcjgqyp.up.railway.app


I had a quick look at your application. You recently changed your REACT_APP_API_URL variable, and the current value of that variable is a list of two different URLs. You may want to set it to just a single value.

Furthermore, consider using the built-in private network for better performance and security (and reduced networking costs). Read about Private Networking in the Docs: https://docs.railway.com/guides/private-networking


Status changed to Awaiting User Response Railway 8 days ago


jaliljzarifa
PRO

8 days ago

Thanks for the link, but my issue isn't with private networking.

Problem: My frontend loads fine at ticketvault.net, but I get 502 Bad Gateway errors when making API calls to the backend endpoints (like my-tix.net/api/auth/login, /api/admin/users, etc.).

Current setup:
screenshot attached

Specific symptoms:

  • Static site/frontend works

  • Any fetch() calls to /api/* endpoints return 502

  • Same API calls work fine on the Railway-provided domain

This seems like a public networking configuration issue where static content serves but API routes aren't being properly proxied through Cloudflare to the Railway backend.

Could you help with the correct configuration for API routing through custom domains with Cloudflare proxy enabled?


Status changed to Awaiting Railway Response Railway 8 days ago


jaliljzarifa
PRO

8 days ago

My Railway-provided domain works perfectly, but my custom domain returns 502 Bad Gateway errors for all requests.

Working:

Not working:

Configuration:

Question: Since the Railway domain works but the custom domain doesn't, this seems like a domain routing issue. Is there something specific about how my-tix.net should be configured differently than the working Railway domain?

The fact that I get HTML error pages suggests requests aren't reaching my FastAPI backend through the custom domain.

Thanks!


8 days ago

Both the Railway domain and the custom domain work for me. I'm going to move this thread to the community, as the issue would be outside of Railway's control.


Status changed to Awaiting User Response Railway 8 days ago


8 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 8 days ago


clashing
HOBBYTop 1% Contributor

7 days ago

https://station.railway.com/questions/dns-configuration-issue-for-custom-domai-10696e8a#fcrf

jaliljzarifa, you can check my post on how to configure custom domain. BTW, is your custom domain setup in Railway showing Setup Complete (like shown in the image)?

Attachments


Status changed to Solved jaliljzarifa 5 days ago