location / {# /可以改为路径 例如/test/img
# 允许所有以 mmix.cc 结尾的域名访问资源
if ($http_origin ~* "^https?://[a-zA-Z0-9_-]+\.yyfj\.cc(:[0-9]+)?$") {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type';
add_header 'Access-Control-Allow-Credentials' 'true';
}
# 其他 Nginx 配置项...
}
版权属于:
星野梦璃
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论 (0)