nginx出现 “414 request-uri too large”

公司项目有一个模块,在请求查询的时候使用了Get方法,由于拼接的url过长,导致nginx出现了“414 request-uri too large”错误。
出现这种问题可以按照如下解决:
在nginx的nginx.conf修改如下参数的:

client_header_buffer_size 512k;
large_client_header_buffers 4 512k;

worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log  logs/error.log  debug;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

# HTTP服务
http {
    include       mime.types;
    default_type  application/octet-stream;
    client_header_buffer_size 512k;
    large_client_header_buffers 4 512k;

    server {
        listen 443 ssl;
        server_name      localhost;
        ssl_certificate      C:/Users/Administrator/Desktop/5694529_ems.peakinfo.cn_nginx/5694529_ems.peakinfo.cn.pem;  # 这个是证书的crt文件所在目录
        ssl_certificate_key   C:/Users/Administrator/Desktop/5694529_ems.peakinfo.cn_nginx/5694529_ems.peakinfo.cn.key;  # 这个是证书key文件所在目录

        ssl_session_cache    shared:SSL:5m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;      
         location /callApi {
            proxy_pass http://127.0.0.1:30006/peak/timatrix/callApi;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port $server_port;
        }
        location / {
            #root html;
            #index  index.html index.htm;
            proxy_pass http://127.0.0.1:8080;     # spring boot 项目的端口号      
            # 固定写法-------------
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port $server_port;
        }
    }
}

你可能感兴趣的:(nginx,nginx)