Why does fastly trigger a 307 redirect from s3 regional (non-standard) bucket
I'm trying to serve content from s3 buckets that could be in any of the s3 regions.
I want fastly to follow the s3 url and cache the content.
This works fine for a 'standard' s3 url such as: mybucket.s3.amazonaws.com/path/to/content. I just set the host header to 'mybucket.s3.amazonaws.com' and set the backend to s3.amazonaws.com and it works great.
However if I have content stored in say a non-standard region, let's just say eu-central-1 e.g.:
http://myregionalbucket.s3.eu-central-1.amazonaws.com/path/to/content and I strip the region in the url to myregionalbucket.s3.amazonaws.com/... and set host header to myregionalbucket.s3.amazonaws.com, when I try with fastly I get a 307 Temp redirect back to the regional bucket url.
However using curl with the same url and host header, it works fine and I get a 200 with no redirects.
What is causing the request through fastly to trigger a 307 redirect.
Thank you
-
Hi Chris, thanks for reaching out to Fastly Support! I've provided a document below that should fix the issue you're having. Take a look at that and let me know if you have any questions.
Link here [https://docs.fastly.com/en/guides/amazon-s3#following-redirects-to-s3-objects-and-caching-s3-responses ]
-
Hi Joe,
Yes I'd seen that article and have tried it in my vcl. I think that article describes serving content from a bucket in only one region.
If you try to serve content from a bucket in a non-standard region it seems that s3 now sends a 307 redirect to the region specific endpoint when trying to use the global endpoint. So it seems we need a backend per region to get around this.
Please sign in to leave a comment.
Comments
3 comments