Nginx提示400(bad request)错误
nginx作代理,相同的配置可以将请求转发到weblogic的7001端口,但是转发至8080端口报400错误;下面是配置文件和日志文件;即http://188.185.1.191:7001/是可以正常访问,但是http://188.185.1.191:8080无法正常访问,http://188.185.1.189:8080是可以正常访问;nginx安装在188.185.1.191服务器上;
=========================配置文件=========================
server
{
listen 7001;
server_name localhost;
location / {
#allow 36.0.16.106;
#deny all;
proxy_redirect off;
proxy_set_header Host $host:server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_pass http://188.185.1.189:7001/;
}
access_log logs/7002access.log;
}
server
{
listen 8080;
server_name localhost;
location / {
proxy_redirect off;
proxy_set_header Host $host:server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_buffering off;
proxy_pass http://188.185.1.189:8080/;
}
access_log logs/8080access.log;
}
=======================日志文件============================
188.185.4.82 - - [02/Mar/2016:17:45:43 +0800] "x03" 400 172 "-" "-"
188.185.4.82 - - [02/Mar/2016:19:11:06 +0800] "GET /index.jsp HTTP/1.1" 400 5 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
188.185.4.82 - - [02/Mar/2016:19:11:09 +0800] "GET /favicon.ico HTTP/1.1" 400 5 "http://188.185.1.191:8080/index.jsp" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
188.185.4.82 - - [02/Mar/2016:19:11:19 +0800] "GET /index.jsp HTTP/1.1" 400 5 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
188.185.4.82 - - [02/Mar/2016:19:11:20 +0800] "GET /favicon.ico HTTP/1.1" 400 5 "http://188.185.1.191:8080/index.jsp" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
引用来自“首席吊炸天”的评论
把 nginx 默认缓冲容量调大试试, large_client_header_buffers 4 32k;
已经调过了,nginx版本是1.8.1的,日志还是会报400错误
http://188.185.1.189:7001这个是可以正常转发请求并访问的,转发至http://188.185.1.189:8080这个会报400错误
proxy_pass http://188.185.1.189:7001/;
改成
proxy_pass http://188.185.1.189:7001; 试试
如果还是有问题,可以把weblogic的访问日志打开