Using Nginx, I was able to re-route traffic from my subdomain api.localhost to localhost port 8080.
When I send requests to api.localhost from localhost, the backend server is able to pick the requests up.
The problem is when I try to deploy my application to production, where I have cloudflare as my dns.
When I access mywebsite.com, I can load my frontend pages.
When I access api.mywebsites.com, there’s no response from the backend.
However, if I go to my vm and run curl on api.localhost, the backend is able to see the requests.
How do I reroute api.mywebsite.com to api.localhost?
Thanks! I’ll try adding an ingress rule as you mentioned.
Out of curiosity, is it possible to achieve this with only the dns settings?
I’d like to try setting this up without any cloudflare-only software if possible
DNS only doesn’t forward ports. It only replicates what you already have without using any part of Cloudflare (what you already had before adding your domain here).
The only exception is SRV records, which tends to be application-specific. Your application would need to support it, but that’s separate from any Cloudflare functionality.