Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

414 Request-URI Too Large when uploading photo

Hi
Using IONIC camera service. Getting this error after taking a pic and trying to upload it.
I noticed that the image is stored as data and not the URI. That is most probably why its not working. Why is the image stored as base64 data and not a URL?

How to fix this?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

414 Request-URI Too Large when uploading photo

Hello Deon,

The common rule to upload big variables, like images is: using the POST request body parameter instead of GET request URL parameter. It has to solve the issue.

If you need to get a link to the file instead of it's base64 value, please change the request parameter "destinationType" of the camera service from "Data URL" to "File URL"

hedmondjohn
Posts: 1
Joined: Wed Dec 28, 2022 7:54 am

Re: 414 Request-URI Too Large when uploading photo

This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information. The HTTP 414 URI Too Long response status code indicates that the URI(Uniform Resource Identifier) requested by the client is longer than the server is willing to interpret.

To resolve this problem :

By POST request: Convert query string to json object and sent to API request with POST.

By GET request: Max length of request is depend on sever side as well as client side. Most webserver have limit 8k which is configurable. On the client side the different browser has different limit. The browser IE and Safari limit to 2k, Opera 4k and Firefox 8k. This means that the max length for the GET request is 8k and min request length is 2k.

If exceed the request max length then the request truncated outside the limit by web server or browser without any warning. Some server truncated request data but the some server reject it because of data lose and they will return with response code 414 Request-URI Too Large.

Under Apache, the limit is a configurable value, LimitRequestLine. If you want to increase URL limit to 5000 characters (bytes), add the following lines to your server configuration or virtual host file.

LimitRequestLine 5000

If you want to increase maximum header length supported by Apache to 3000 characters, then add the following line.

LimitRequestFieldSize 3000

Return to “Issues”