且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何解决 HTTP 414“请求 URI 太长"?错误?

更新时间:2022-04-01 23:41:23

在Apache下,限制是一个可配置的值,LimitRequestLine.如果您想支持更长的请求 URI,请将此值更改为大于其默认值 8190 的值.该值位于 /etc/apache2/apache2.conf 中.如果没有,请在 AccessFileName .htaccess 下添加一个新行 (LimitRequestLine 10000).

Under Apache, the limit is a configurable value, LimitRequestLine. Change this value to something larger than its default of 8190 if you want to support a longer request URI. The value is in /etc/apache2/apache2.conf. If not, add a new line (LimitRequestLine 10000) under AccessFileName .htaccess.

但是,请注意,如果您确实遇到了此限制,那么您可能是在滥用 GET.您应该使用 POST 来传输此类数据——尤其是因为您甚至承认您正在使用它来更新值.如果您查看上面的链接,您会注意到 Apache 甚至说在正常情况下,不应更改默认值."

However, note that if you're actually running into this limit, you are probably abusing GET to begin with. You should use POST to transmit this sort of data -- especially since you even concede that you're using it to update values. If you check the link above, you'll notice that Apache even says "Under normal conditions, the value should not be changed from the default."