nginx config as follows:
server {
listen 80;
listen [::]:80;
add_header \'Access-Control-Allow-Origin\' $http_origin;
I had same issue. Problem is that nginx add header only for 200, 204, 301, 302 and 304 status codes.
To get same headers for every type of status codes you have to add [always] in the end of add_header directive like this.
add_header 'Access-Control-Allow-Origin' $http_origin always;
Hope it will help you)