需要在add_header Access-Control-Allow-...后面添加 always 参数,如下:
add_header Access-Control-Allow-Origin '$http_origin' always;
add_header Access-Control-Allow-Credentials 'true' always;
add_header Access-Control-Allow-Headers 'Pragma,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' always;