当使用NGINX作为代理时,试图返回'501未实现‘HTTP响应。默认行为是使用“405不允许的方法”响应。有人知道如何绕过默认405响应吗?
我们尝试了以下配置选项,但没有效果。
if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS|CONNECT|TRACE)) {
return 501;
}
error_page 405 =501 @405;
location @405 {
root /;
proxy_pass http://localhost:3000;
}
location / {
proxy_pass http://localhost:3000;
}环境
nginx版本: nginx/1.2.1
Linux3.2.04-AMD 64 #1 3.2.54-2 x86_64 GNU/Linux
发布于 2014-11-18 21:20:20
在代理位置块中设置proxy_intercept_errors on;。
https://stackoverflow.com/questions/26999890
复制相似问题