Response with 422 status code from nginx lacks 'Access-Control-Allow-Origin' header

后端 未结 1 609
灰色年华
灰色年华 2021-01-25 07:40

nginx config as follows:

server {
            listen 80;
            listen [::]:80;

            add_header \'Access-Control-Allow-Origin\' $http_origin;
               


        
相关标签:
1条回答
  • 2021-01-25 07:57

    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)

    0 讨论(0)
提交回复
热议问题