Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

Time to break out Wireshark[.org]. Capture an actual HTTP request on the wire so you can see what really constitutes the total size. Keep in mind that the total request size, including http headers (which includes cookies) could push you over the limit. Some browser add-ons or proxies could be adding to the request.

share|improve this answer

Alright I think I finally got somewhere!

I had trouble setting up wireshark on the server, so first I ended up using apache's LogFormat directive to log the amount of bytes coming in the request, with the %I parameter.

I noticed that when I got the 413 error, the server received less bytes with the request, then when it was processed properly. Then I used mod_dumpio to have a look at the whole request, and sure enough a lot of it was missing when I was getting the error. Also, the 70007 code was popping up in the logs, which as far as I understand means timeout.

So I started to think the problem might actually be my connection rather then anything to do with the server. I asked some people to test the site, and no one reported any problems, so I'm guessing that's it.

So in the end I guess there's nothing to see here, but maybe my experience will save some poor soul the stress I went through.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.