nginx跨域解决方案

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

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

发表评论

您的邮箱地址不会被公开。