6

We have a requirement to send large data as part of URL which will be read by angular to render the page. Url is of more than 10000 characters. But cloudfront is returning below error -

Bad request. Generated by cloudfront (CloudFront) Request ID: I2fOApzZr4psKrWsY6abezp5R0m30zKDKE7c0MuB_JkjWbvxz5GVnQ==

Browser console returns error code 413 with below message -

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

Is there any settings in cloud front which can allow to accept large URL request.

I know on apache that there are settings like LimitRequestBody which can allow large inputs, but request is not reaching to apache and error out by cloudfront itself.

When I played with the number of characters - cloudfront breaks after 8226 characters.

Sammy Pawar
  • 1,201
  • 3
  • 19
  • 38
  • Even if you can, I'd rather not (ab)use urls to put that much data. Related: http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers - cloudfront is well within reason not to accept urls of this size. – zapl Oct 25 '16 at 16:30
  • our angular js code is kind of a template which is fed the data retrieved from some other content service. Is there a way we can post the data to angular js, instead of it reading the data from URL. I don't want this to become angular js question though. Angular can't call api directly because of some authentication issues. And I don't know abc of angular. – Sammy Pawar Oct 25 '16 at 16:51
  • There is surely a way to do that but you would need to explain the system in much more detail. => Post a new question (or several, this sounds like a rather large change that is needed). – zapl Oct 25 '16 at 17:29

1 Answers1

7

This isn't supported. CloudFront has these hard limits, which are reasonable for most applications:

Maximum length of a request, including headers and query strings: 20,480 bytes

Maximum length of a URL: 8,192 bytes

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html

The apparent discrepancy between 8,226 − 8,192 = 34 is probably attributable to the length of your hostname and http:// if you're counting that. CloudFront's documentation says "URL" but the limit may actually only apply to the combined length of path + query-string, since the Host: header is separate from the rest of the request, in the actual HTTP protocol.

The limits mentioned above, and some others, do not appear to be negotiable.

Other limits, such as bandwidth (40 Gbps), number of web distributions per AWS account (200) are merely default limits, which you can potentially have increased by submitting a request to AWS support describing your use case, but that does not appear to be the case, here.

Angular can't call api directly because of some authentication issues.

This sort of sounds like a case for ajax calls to a proxy REST API that fetches the data from the source requiring authorization, so the browser side code doesn't have to... maybe something in Lambda behind API Gateway.

bwegs
  • 3,769
  • 2
  • 30
  • 33
Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427