set $cors_origin "";
if ($http_origin ~* "^https://www.abc.com$") {
set $cors_origin $http_origin;
}
if ($http_origin ~* "^https://abc.com$") {
set $cors_origin $http_origin;
}
if ($http_origin ~* "^https://www.abc.cn$") {
set $cors_origin $http_origin;
}
if ($http_origin ~* "^https://abc.cn$") {
set $cors_origin $http_origin;
}
add_header Access-Control-Allow-Origin $cors_origin;
location / {
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin $cors_origin;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
return 404;
}
}