The 414 request URI too large error appears in the web project interface request
Let’s share the relevant solutions:
First, change the get request to post request
If your web request is a get request, consider changing it to a post request
Get request: when sending data, the get method adds data to the URL; The length of the URL is limited (the maximum length of the URL is 2048 characters)
Post request: no restrictions
Second, the logic of adjusting front-end request parameters
For example, if you call the background interface from the foreground, you need batch operation, and you may pass a data collection object JSON string, which will greatly increase the length of the parameter. At this time, we can consider only passing the string composed of ID, and then in the background logic processing, query the required data according to the ID string, and then complete the corresponding coding work
3. Server configuration adjustment
Server configuration adjustment is the most effective solution. The server configuration adjustment is global, but it should be handled according to the actual business needs. You can’t adjust the parameter length too much at will, which will also have a great impact on the system performance. Server configuration adjustment mainly includes nginx, Tomcat, IIS, Apache, etc
3.1 java project
Modify the server.xml file in Tomcat
< Connector
port=”8080″
protocol=”HTTP/1.1″ connectionTimeout=”20000″redirectPort=”8443″
maxHttpHeaderSize=”65536″URIEncoding=”UTF-8″ />
3.2 PHP project:
Add the following parameters directly to Apache’s httpd.conf configuration file:
LimitRequestLine 40940
LimitRequestFieldSize 40940
3.3 net project
Add the following statement in the system. Web configuration section of the web. Config file
<httpRuntime targetFramework="4.5.1" requestValidationMode="2.0" maxRequestLength="1024000" executionTimeout= "3600" />
Maxrequestlength sets the length of the post
3.4 modification content of nginx configuration file:
The nginx. Conf configuration file will just enlarge the two caches
#Large is used when the total length of request header is greater than 512k_ client_ header_ The buffer set by buffers
client_ header_ buffer_ size 512k;
#large_ client_ header_ The parameters of buffers instruction are 4, 512k and 8K by default. Apply for 4 512k
large_ client_ header_ buffers 4 512k; Restart nginx command
refresh nginx service
1. Linux server 2
Enter the nginx executable directory SBIN and enter the command./nginx – s reload
cd /usr/local/nginx/sbin/
./nginx -s reload
2. Windows Server 2
nginx.exe -s reload
It technology sharing community
Personal blog website: https://programmerblog.xyz
Programmer efficiency: drawing flow chart common tools programmer efficiency: sorting common online note taking software telecommuting: common remote assistance software, do you know?51 MCU program download, ISP and serial basic knowledge Hardware: circuit breaker, contactor, relay basic knowledge