系统相关
首页 > 系统相关> > Nginx下使用RESTful的UPDATE与DELETE发生405错误的解决方法

Nginx下使用RESTful的UPDATE与DELETE发生405错误的解决方法

作者:互联网

chrome浏览器会在请求头中错误地添加Origin参数导致405错误,在nginx中的nginx.conf添加如下配置

proxy_set_header Origin “”;

location / {
		proxy_set_header Origin "";
		
        proxy_pass http://127.0.0.1:8080;
        add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS, DELETE';
        add_header Content-Security-Policy upgrade-insecure-requests;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        #proxy_set_header X-Forwarded-Proto $scheme;
}

标签:Origin,set,Forwarded,header,UPDATE,Nginx,405,add,proxy
来源: https://blog.csdn.net/weixin_43568988/article/details/117381611