Random HTTP 413 error on apach2/php/joomla site
- by jfab
I have a Joomla site, and every once in a while when I submit something via a form, I get a HTTP 413 error:
Request Entity Too Large
The requested resource
/index.php
does not allow request data with POST requests, or the amount of data provided in the
request exceeds the capacity limit.
In the error.log file I get:
Invalid Content-Length, referer: [site]/index.php
It doesn't seem this has anything to do with the actual size of the request, for the following reasons:
a) I tinkered with the configuration of both Apache, and PHP.
In Apache I tried increasing LimitRequestBody, and in PHP post_max_size, max_input_vars, memory_limit, and even upload_max_filesize. Every value is far beyond what is sent in a typical request that generates an error.
b) The error pops up quite randomly, and often just hitting refresh allows me to get through.
c) I checked the request in Fiddler to make sure everything is right with the content-length stated in the header, and the content of the request itself. Everything appears to be in order.
A curious thing is that when I resent the exact same request via Fiddler, I never got the error. It seems I can only recreate it through a browser.
So I'm at my wit's end here. I don't even know where to look for the problem anymore.
I don't know if it's Apache or PHP (though I can't find anything in PHP error logs, so maybe that means Apache is the more likely culprit?), or PHP in general, or my Joomla site in particular (my bets were on Joomla until a recreated the error on a test script, with a very basic post form, though it does pop up much more often on the Joomla site).
If anyone can give any advice on where to even begin with this, I'll be very grateful!