宝塔 Nginx 设置允许跨域访问

选择允许跨域的网站,选择设置,注意不要直接去修改Nginx配置。无效

 增加允许跨域访问配置。

 add_header Access-Control-Allow-Origin *;
 add_header Access-Control-Allow-Headers Origin,Accept,Authorization,platformId,ut,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type;
 add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
 add_header Access-Control-Allow-Credentials true;

保存后关闭网站重启nginx;

原文:https://blog.csdn.net/qq_24118445/article/details/136609743

 

posted @ 2024-08-22 23:34  zhang_you_wu  阅读(2376)  评论(0)    收藏  举报