501 Issue with the Cloudfront having Origin group

0

Hi,

TLDR; serving non-existence file from S3 origin using the Range: 0- header fails

I have set a simple cloudfront cdn which serves the file by using the cid of ipfs. It is served from an origin group containing s3 bucket and s3 object lambda access point. First s3 is first and lambda on second with a fallback of 404,403. The lambda is simply a downloader that downloads a file and serves it if it is the first time. Currently, everything is working good for image and text files but we found an issue on files which are video files. One of the clients is loading it directly in html5 video tag eg. http://<domain>/ipfs/<cid>. The problem with this is Chrome browser will send the Range: 0- header for the first time and we get 501 issues on that every time. When I checked the logs of Cloudfront I can only see OriginError with 69 bytes of request and the request time is just 1.6 seconds. AFAIK if it was a normal first-time request it would take 15 sec at max.

For debugging, i even checked for logs in my Lambda but it never hit that lambda. So I am thinking there is something wrong with Cloudfront to Origin (S3) when we browser sends the Range header for buffering the first bytes in the video player.

If I load it from a direct browser URL then it loads from lambda correctly, and the next time I load it up it works again fine. So it is definitely the Range bytes header in request when the files are not available in S3 Bucket and it could not process so sends 501 error. I read more about how the GET range request from here works but it seems to be working only for valid S3 objects. Currently, if there is no object and it throws an error and cannot go to the fallback of another origin that origin group.

Could anybody from the AWS team help on this, please?

1 Answer
0
  • But mine is 501 and the link that you sent does not contain the 501 specific error for debugging. Also the origin to the source is working fine in normal context but when I do use the Range header it fails. So there must be something different that is throwing 501 error while doing a connection from cloudfront to Origin.

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