Nginx提示400(bad request)错误

GOD__ 发布于 2016/03/02 20:44
阅读 5K+
收藏 0

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"


加载中
0
FeiFeiZheng
FeiFeiZheng

 proxy_pass http://188.185.1.189:7001/;   

改成 

 proxy_pass http://188.185.1.189:7001; 试试 

如果还是有问题,可以把weblogic的访问日志打开

GOD__
GOD__
http://188.185.1.189:7001这个是可以正常转发请求并访问的,转发至http://188.185.1.189:8080这个会报400错误
0
首席吊炸天
首席吊炸天
把 nginx 默认缓冲容量调大试试, large_client_header_buffers 4 32k; 
GOD__
GOD__
已经调过了,nginx版本是1.8.1的,日志还是会报400错误
0
首席吊炸天
首席吊炸天

引用来自“首席吊炸天”的评论

把 nginx 默认缓冲容量调大试试, large_client_header_buffers 4 32k; 
400 错误,Web 服务器认为客户端发送的请求数据流不正常。
返回顶部
顶部