nginx静态html页面接收post请求,报405 not allowed错误

nginx静态html页面接收post请求,报405 not allowed错误
背景:

对接连连h5快捷支付时,需在连连支付成功页面点击返回商户按钮,跳转到商户的支付成功页面,商户的支付成功页面是html页面不是jsp页面,由于连连返回商户属于form表单提交post请求方式,所以会报405 not allowed 错误。为了让nginx的静态页面能够响应post请求,也在本论坛中找了好多相关的内容。最后用下面这种方式解决了问题。

解决方案:
修改nginx.conf配置文件,在server{}中添加error_page 405=200@405

error_page 405 =200 @405;
location @405 {
proxy_method GET;
proxy_pass http://localhost:8080;
}
proxy_pass http://可以跟你的域名或者服务器地址

猜你喜欢

转载自blog.51cto.com/13293070/2433558