I am struggling to get NGINX to proxy the CORS headers back and forth from my application. The allowed origins are specified by my ASP.NET Web Application and I would like to proxy these headers back to the client. The application runnning outside of Kubernetes handles CORS headers perfectly so it appears that the application has CORS configured correctly. The Kubernetes NGINX ingress controller doesn't seem to allow me to do this as far as I can tell.
I would like to continue to allow my applicaiton to handle the allowed origins and therefore I just need to configure the NGINX reverse proxy to pass all headers. Looking at the documentation proxy_pass_request_headers
is set to on
by default. My previous understanding of NGINX is that this config setting is what is required when proxying to another server in order for headers to be passed backwards and forwards.
The annotations enable-cors
and the various configration options around CORS outlined in the documentation are of little use to me as they assume that the Ingress Controller is the source of truth on the allowed origins. Which in my case it is not.
I would have expected this to be a common request to allow the application to handle CORS but I am struggling to find any soltions to this issue.
Many thanks in advance for any help anyone can provide!
UPDATE - Add Diagram
I have created a little diagram with my understanding of the topology here. This may well be an oversimplification of the process but hopefully you can understand what I am trying to achieve more easily.