3

My environment is a shared hosting package by 1und1 (1and1). Locally on my laptop, everything works fine.

I'm sending quite a large AJAX request to the server (~1.2MB) which worked fine for a long time now. However, a few days ago it stopped working and I keep getting the following response:

413 Request Entity Too Large

The requested resource [my request URL] does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.

When I lower the size of the POST parameter (a long JSON-string), then everything works as expected. The limit is somewhere around 1MB (determined by trial and error).

I've found a lot of suggestions what the cause could be. E.g. the following php config values. However, they are more liberal than the ones on my local machine and I cannot see where they could be a limit here:

  • max_input_time = -1
  • max_execution_time = 50000
  • upload_max_filesize = 64M
  • post_max_size = 64M
  • memory_limit = 256M

Then, another config value often appears in solutions, the apache config LimitRequestBody. The problem here is: AFAIK I don't have acccess to changing it on the 1and1 shared hosting - and I cannot find a way to view the apache error log...

I initially thought that the LimitRequestBody must be the cause.

But why can I upload files via a normal POST HTML file form then (tested with a 4MB file) on the same server (using the Symfony 2 form builder with a filetype object which seems to translate into a standard HTML file upload form)? As far was I understand the LimitRequestBody (and if applicable also SecRequestBodyNoFilesLimit) value, it should also cause the same error here, if it really was the cause, right?

So does anyone has another idea what I could do to debug this error any further? Or has a solution to my question above? Or at least any ideas how to workaround this?

PS: SSLRenegBufferSize should not be relevant when accessing the webpage without https, right?

Community
  • 1
  • 1
mozzbozz
  • 3,052
  • 5
  • 31
  • 44

1 Answers1

1

413 errors occur when the request body is larger than the server is configured to allow, and there is only so much you can do especially if the server it not under your control. Here’s is an idea:

Ask your hosting company to set the LimitRequestBody directive in either your httpd.conf file or a local .htaccess file to be higher. More Info

Community
  • 1
  • 1
Neo
  • 3,309
  • 7
  • 35
  • 44
  • OP already states their PHP settings above and these do not look like they'd be the issue. If OP can edit their local `.htaccess` (as they won't have access to `httpd.conf`) they may be able to use your first suggestion – Martin Nov 10 '16 at 16:35
  • I've tried setting that value in a `.htaccess`-file already - and tried to place it about everywhere. I could not find any difference, though. However, I was really unsure where I should've put the file? In Symfonys web-directory? The cache folder? The controller directory? Do you have a suggestion there? – mozzbozz Nov 10 '16 at 16:39
  • 1
    @mozzbozz with `.htaccess` fils you need to clear your local browser cache when updating them, so typically you need to delete your website history from your browser so then your browser will redownload the newer server htaccess. I think with Symfony you should put the htaccess in the `/web/` folder but best you research that as I'm unsure. – Martin Nov 10 '16 at 16:42
  • Alternatively next step would be to get in touch with 1and1 and ask them if they can allow you to set these variables in your `.htaccess` (changes to some httpd.conf settings may/will be denied for client accounts). – Martin Nov 10 '16 at 16:43
  • I think your limited at the server, and may want to cotact hosting company as in my answer. As another suggested above you may want to attempt to send as a file. – Neo Nov 10 '16 at 16:44
  • Contacting 1and1 would be the next step, in case I cannot resolve the problem on myself and with your help. However, I haven't read a lot of positive things about their service, so I don't have too much hope there... – mozzbozz Nov 10 '16 at 16:48
  • @mozzbozz I used to be with them, they're not the best, but they're not too bad, I remember thinking that often what you get from them changes depending on who you talk to and what time of day it is, so perhaps have a drink before hand and have a "chat" get some connection then drop in your request (I should perhaps qualify we where biggish customers)! – Martin Nov 10 '16 at 16:54