I want to add CORS to my server.
I have configured my nginx according to this: https://michielkalkman.com/snippets/nginx-cors-open-configuration.html
It seems to work fine when the server returns 200.
However, if the server returns something else, like 400 when the request is wrong, or 500 if internal error, the browser shows the No 'Access-Control-Allow-Origin' header instead of reaching the error handler like it should.
What configuration am I missing to make it work?