I'm new to ionic. I am trying to make app in ionic and api's in laravel. I am trying to send base64 in body but it's giving me 413 Payload Too Large. If i don't send base64 then it's retuning 201 created
According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413 :
The HTTP 413 Payload Too Large response status code indicates that the
request entity is larger than limits defined by server
So this issue is not related to your Ionic application, neither to the laravel API. Your server may have file upload size limits. By default the max size is 2MB.
You can edit this value by editing your php.ini :
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
Related
I have an API which returns a file to the client based on start & end date filters it sends to the server.
The server has a MAX_FILE _SIZE config value in order the reduce the amount of data it returns to the client.
In case the server is sending a truncated file due to its size what is the appropriate resonse code?
I think HTTP 206 is the one that seems to be most fitting.
The HTTP 206 Partial Content success status response code indicates that the request has succeeded and has the body contains the requested ranges of data, as described in the Range header of the request.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206
https://www.restapitutorial.com/httpstatuscodes.html
I am trying to create a Watson Visual Recognition Create Classifier using v3 of the rest API following the documentation https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/visual-recognition/customizing.shtml#goodclassifying which states:
There are size limitations for training calls and data:
The service accepts a maximum of 10,000 images or 100 MB per .zip file
The service requires a minimum of 10 images per .zip file.
The service accepts a maximum of 256 MB per training call.
However, using a "positive" zip file of 48MB containing 594 images (max size of an image is 144Kb) and a "negative" zip file of 16MB containing 218 images (max size of an image is 114Kb) but I keep getting the error:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
In response to:
curl -X POST -F "good_positive_examples=#positive.zip"
-F "negative_examples=#negative.zip"
-F "name=myclassifier"
-H "X-Watson-Learning-Opt-Out=true"
"https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classifiers?api_key=<mykey>&version=2016-05-20"
I've kept trying reducing the file size by deleting images within the zips and re-trying but I'm well below the stated limits.
Anyone got any idea?
Thanks
This (413 Entity Too Large) error is intermittent when submitting jobs for training classifiers. I have written a script to process a directory structure of images as classes for training, including both a training (51%) and a test (49%) set. As the API restricts payload sizes to 100MB per ZIP file, I zipsplit(1) the class ZIP files into batches. When submitting those batches I receive this error, but discard and retry; invariably after 2-3 attempts, the API call succeeds.
I would guess that your in-bound connection manager is counting bytes including re-transmissions over the socket and not reporting actual payload size.
I recommend splitting ZIPs into sizes of <95 MB in order to avoid this complication in submitting images to the training API.
The code is in the age-at-home project under dcmartin on github.com; the training script is in bin/train_vr and testing script is in bin/test_vr. Your mileage may vary.
I just tried with 2 zip files (~45 MB each) and it works.
I think it was a temporary problem in the nginx server. The requests to Visual Recognition go to nginx before going to the actual service.
I'm working on a simple web server that I want to handle long Get values.
If request is larger than 4096, and it is GET value I want to send header code to client that understand request is too large.
client sends a huge cookie in buffer that make it larger than my web server can get.
which header code should I send? 414 Request-URI Too Long or 413 Payload Too Large?
client sends a huge cookie in buffer that make it larger than my web server can get.
The client should be sending back only the cookies that your web server has previously given the client. If your own cookies are too large for your web server to handle, you need to shorten them.
which header code should I send? 414 Request-URI Too Long or 413 Payload Too Large?
Neither. The request URI is not what is too long, so 414 is not appropriate. And a GET request does not have a body, only headers, so 413 is not appropriate, either.
The response code you should use is 431 Request Header Fields Too Large, which is defined in RFC 6585 Additional HTTP Status Codes:
5. 431 Request Header Fields Too Large
The 431 status code indicates that the server is unwilling to process
the request because its header fields are too large. The request MAY
be resubmitted after reducing the size of the request header fields.
It can be used both when the set of request header fields in total is
too large, and when a single header field is at fault. In the latter
case, the response representation SHOULD specify which header field
was too large.
For example:
HTTP/1.1 431 Request Header Fields Too Large
Content-Type: text/html
<html>
<head>
<title>Request Header Fields Too Large
</head>
<body>
<h1>Request Header Fields Too Large
<p>The "Example" header was too large.
</body>
</html>
Responses with the 431 status code MUST NOT be stored by a cache.
I need to know the maximum length of
JSON Web Token (JWT)
In specs there are no information about it. Could be that, there are no limitations in length ?
I've also been trying to find this.
I'd say - try and ensure it's below 7kb.
Whilst JWT defines no upper limit in the spec (http://www.rfc-editor.org/rfc/rfc7519.txt) we do have some operational limits.
As a JWT is included in a HTTP header, we've an upper limit (SO: Maximum on http header values) of 8K on the majority of current servers.
As this includes all Request headers < 8kb, with 7kb giving a reasonable amount of room for other headers. The biggest risk to that limit would be cookies (sent in headers and can get large).
As it's encrypted and base64ed there's at least 33% wastage of the original json string, so do check the length of the final encrypted token.
One final point - proxies and other network appliances may apply an abitrary limit along the way...
As you said, there is no maximum length defined in the RFC7519 (https://www.rfc-editor.org/rfc/rfc7519) or other RFCs related to JWS or JWE.
If you use the JSON Serialized format or JSON Flattened Serialized format, there is no limitation and there is no reason to define a limitation.
But if you use the JSON Compact Serialized format (most common format), you have to keep in mind that it should be as short as possible because it is mainly used in a web context. A 4kb JWT is something that you should avoid.
Take care to store only useful claims and header informations.
When using heroku the header will be limited at 8k. Depending of how much data are you using on jwt2 it will be reach. The request, when oversize, will not touch your node instance, heroku router will drop it before your API layer..
When processing an incoming request, a router sets up an 8KB receive
buffer and begins reading the HTTP request line and request headers.
Each of these can be at most 8KB in length, but together can be more
than 8KB in total. Requests containing a request line or header line
longer than 8KB will be dropped by the router without being
dispatched.
See: Heroku Limits
There is a ColdFusion function where we have to pass more then 100 arguments to get a search result. When passing these 100 odd parameters into the function, ColdFusion throws the error: "404 not found"
I tried to increase post size Limit in CF server settings from 100 to 300 but am still getting the error.
Increasing the "post size limit" only changes how many megabytes can be received, not the quantity.
For that, you need to increase the "post parameters limit" in neo-runtime.xml, by adding* or updating the XML node:
<var name='postParametersLimit'><number>300.0</number></var>
Then save the file and restart the ColdFusion server for the changes to take effect.
* If the 'postParametersLimit' field is not present, you can insert it immediately before <var name='postSizeLimit'> - whilst it's not mandatory to place it there specifically, this is a simple way to ensure it does not get nested invalidly.
Note that this affects the number of form fields (i.e. HTTP POST parameters) being submitted - not the number of arguments to a function, but this is presumably your problem because the latter should not cause a 404 error.
In ColdFusion 10, the post parameters limit is a setting in the Administrator:
Server Settings / Settings / Request Size Limits / Maximum number of POST request parameters
This setting defaults to 100.
Increase it to the required amount of parameters required to be accepted.
(We just had to increase ours to 300!)