if ($request_filename ~* xxx.js) {
add_header Cache-Control no-cache;
# 设置是否允许 cookie 传输
add_header Access-Control-Allow-Credentials true;
# 允许请求地址跨域 * 做为通配符
add_header Access-Control-Allow-Origin * always;
# 允许跨域的请求方法
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
}
遇到某ng文件需要支持跨域的解决方案
最新推荐文章于 2024-12-30 22:37:44 发布
文章详细描述了如何在处理特定JavaScript文件时,使用Apache或Nginx等服务器的.htaccess或nginx.conf配置,设置适当的CORS(Cross-OriginResourceSharing)HTTP头,以允许跨域请求。
7105

被折叠的 条评论
为什么被折叠?



