Cloudfront if-range header is removed, is this a bug?

0

Why does the "if-range" header get removed when sending anything other then GET requests?

The documentation states "CloudFront forwards the header to your origin.". However from what my tests, it seems the header is dropped for POST/OPTIONS/DELETE/UPDATE/.. requests.

I also checked that this is not the case for some of the other headers such as "If-Match" and "If-None-Match".

Am I missing something? This feels like an unintended bug.

b
已提问 7 个月前238 查看次数
1 回答
0
已接受的回答

Hello,

The If-range header is typically used with HTTP GET requests and is used to make a conditional request. Conditional requests in HTTP enables clients to request a resource based on specific condition example ETag, Timestamp. It allows the server to fulfill the request only if the specified ETag or the Last-modified date matches the current version of the requested resources.

For other HTTP methods like POST, DELETE, OPTIONS or UPDATE, the If-range header is not typically used or specified as it is done with GET requests, because the other methods have a different purpose and ways of handling a request.

As per the Range request RFC 7233 , A server MAY ignore the Range header field. However, origin servers and intermediate caches ought to support byte ranges when possible, since Range supports efficient recovery from partially failed transfers and partial retrieval of large representations. A server MUST ignore a Range header field received with a request method other than GET.

In summary, the if-range header with other HTTP methods would be ignored by servers usually as per the rfc. Hence, Cloudfront would also, not forward this header to Origin if its is used with other Methods.

For more information about the Range request header, see Range Requests in RFC 7233, or Range in the MDN Web Docs.

For more information on how CloudFront processes partial requests for an object (range GETs), please click here

AWS
支持工程师
已回答 7 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容