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
asked 6 months ago227 views
1 Answer
0
Accepted Answer

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
SUPPORT ENGINEER
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions