标题:nginx跨域解决方案
作者:
日期:2020-08-04 09:34:12
内容:

实例如下,请根据情况调整:

server
    {  
        listen 80 ;
        server_name api.xxx.com;
        index index.html index.php;
        root  /www/admin/public;     
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
        add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

   location / {
               if ($request_method = 'OPTIONS') { return 204; }             

   }
   include enable-php.conf;
   }




附件:

https://www.cnop.net/uploadfile/2020/0804/20200804094139673.zip


返回列表 网站首页