S3 hosted website with Fastly as CDN


Hello! We were previously using Cloudfront as our CDN and decided to move over to Fastly. An issue we are running in to this is that to get the original react application to work on Cloudfront we had to set a custom error response in Cloudfront so 403's are redirected back to a 200 status which seems to assist in react paths upon reload or loading directly. I am wondering if there are headers that need to be set by the requester which I do not know about aside from same origin? Thanks so much for your help!

2 Answers

Fastly did not have much experience in recreating the custom error response from AWS, so I was a bit on my own with this but this is what I came up with that recreates the same behavior. Add a VCL snippet under the vcl_fetch subroutine and this will recreate the desired behavior: if (beresp.status == 403) { set req.url = "/index.html"; set beresp.status = 200; return (restart); }

Hopefully this helps someone else out in the future!!

answered a year ago

I would reach out the Fastly support team, as the answer depends on some of the Fastly CDN settings which have been applied.

answered a year 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