cloudfront响应状态为413(请求实体太大) [英] cloudfront responds with a status of 413 (Request Entity Too Large)

查看:209
本文介绍了cloudfront响应状态为413(请求实体太大)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要发送大量数据作为URL的一部分,该数据将按角度进行读取以呈现页面.网址超过10000个字符.但是cloudfront返回以下错误-

错误的请求.由cloudfront(CloudFront)生成的请求ID:I2fOApzZr4psKrWsY6abezp5R0m30zKDKE7c0MuB_JkjWbvxz5GVnQ ==

浏览器控制台返回错误代码413,并显示以下消息-

无法加载资源:服务器响应状态为413(请求实体太大)

Cloud Front中是否有任何设置可以接受较大的URL请求.

我在apache上知道有诸如LimitRequestBody之类的设置可以允许大量输入,但是请求无法到达apache并由cloudfront本身出错.

当我玩几个字符时,cloudfront在8226个字符之后中断.

解决方案

不支持此功能.CloudFront具有这些硬限制,对于大多数应用程序来说是合理的:

请求的最大长度,包括标题和查询字符串:20,480字节

URL的最大长度:8,192字节

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

8,226 − 8,192 = 34之间的明显差异可能是由于您的主机名和 http://的长度所致.CloudFront的文档说"URL",但该限制实际上仅适用于路径+查询字符串的组合长度,因为在实际的HTTP协议中, Host:标头与请求的其余部分是分开的

上面提到的限制以及其他一些限制似乎是不容商量的.

其他限制(例如带宽(40 Gbps),每个AWS账户的Web分发数量(200))仅是默认限制,您可以通过向描述您的用例的AWS支持提交请求来增加该限制,但是似乎不是这种情况.

由于某些身份验证问题,Angular无法直接调用api.

这种声音听起来像是对代理REST API进行ajax调用的案例,该代理REST API从需要授权的源中获取数据,因此浏览器端的代码不必...可能是API网关后面的Lambda中的内容./p>

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.

解决方案

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.

这篇关于cloudfront响应状态为413(请求实体太大)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆