问题
I am trying to save an image from Google Images search result but when I send the image's src in the query string parameter it gives the following error:
Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.
Apache/2.4.18 (Ubuntu) Server at 127.0.1.1 Port 80
As I am getting this error on my local machine, it is possible for me to test any ideas you all got.
Note: I did set the LimitRequestLine
and LimitRequestFieldSize
to 100000
in the /etc/apache2/apache2.conf
file. But no luck so far.
Any help is appreciated.
回答1:
Request parameters cannot have an infinite length. My guess is that you reached the maximum length when sending the image src as a query parameter.
From this answer here it seems like you can set LimitRequestLine
and LimitRequestFieldSize
to a maximum of 8192 bytes or anything below (so not above) that value.
And in Apache, if you use that as a webservers, you can limit it to something below the default 8190 bytes, but not to something above it without changing the source code & recompiling.
Read also this question which has lots of more information on the maximum length of your url:
This is a popular question, and as the original research is ~9 years old I'll try to keep it up to date: As of Nov 2016, the advice still stands. Even though IE11 may possibly accept longer URLs, the ubiquity of older IE installations plus the search engine limitations mean staying under 2000 chars is the best general policy.
In other words: try to stay under 2000 chars and use POST for sending large amounts of data...
回答2:
I was also in same problem but solved by adding LimitRequestFieldSize 1000000000 LimitRequestLine 1000000000 lines in httpd.conf file under correct < VirtualHost >
来源:https://stackoverflow.com/questions/40759236/ubuntu-16-04-apache-2-4-18-request-uri-too-long