OK here goes,
I have 2 servers, identical config, HTTP API, port 80 and Cloudflare cert on 443.
Server 1 DNS, A record,
api-server-1.domain.com → IP
Server 2 DNS, A record,
api-server-2.domain.com → IP
Load balancer on
One pool with the 2 servers above.
When I make a request to api.domain.com , there is a HTTP redirect to one of the servers. This bit works.
But, I have a website on
www.domain.com, which consumes the API. Problem is when the web app makes a CORS preflight request, the OPTIONS response contains a redirect, which is not allowed,
preflight is invalid (redirect) or redirect is not allowed for a preflight request
How do I fix this?
Originally I thought the load balancer would always present itself as
api.domain.com and hide the underlying servers but that is not the case. What am I missing?