I have an NginX box with the auth_request
module installed, which authorises each request via our authentication service, and forwards the request on to our backend services if the request is authorised, and also adds CORS headers.
The issue that I'm having, is that when our authorisation service returns a non-200 status code, e.g. 401 for unauthorised users, NginX returns a 401 to the client without any of the CORS headers, regardless of whether they are set by NginX or by our authorisation service.
My question is, how can I add CORS headers to the response from NginX when a 401 is returned? NginX seems to ignore the add_header
command.