vue php option跨域nginx 配置

        #}
                 if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'POST,GET,OPTIONS';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Headers' 'access-control-allow-origin,authorization,content-type,x-requested-with,xx-device-type,xx-token';#注意请求给的什么写上什么:重点
   
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain charset=UTF-8';
        add_header 'Content-Length' 0;
        return 201;
     }
 

你可能感兴趣的:(php,服务器)