Nginx cross-domain if HttpCode is not 200, there will be a problem.

for example, if the title nginx is cross-domain, there will be a problem if the returned HttpCode is not 200

if the requested address HttpCode is 200. there is no problem. If it is not 200, there will be an error that cannot cross domains!
how to set it?

the current setting is:

add_header Access-Control-Allow-Origin  $http_origin;
add_header Access-Control-Allow-Headers "Cookie,Set-Cookie,token,x-requested-with,content-type,withcredentials";
add_header "Access-Control-Allow-Methods" "GET,POST,OPTIONS,DELETE,PUT";
add_header "Access-Control-Allow-Credentials" "true";
Oct.09,2021

not only the server needs to be set up, but the ajax request also needs to be set up
refer to Link description

Menu