I’m hosting a React PWA in an S3 bucket as a static site hosted with cloudflare configured over the bucket with a CNAME
So for example if you try and access:
You’ll get redirected to the index page.
However the error that AWS S3 gives is 403 then redirects the client to the index.html page
e.g. from a curl https://www.k2nlearner.com/explore -v
< HTTP/2 403
< x-amz-error-code: AccessDenied
< x-amz-error-message: Access Denied
So whilst the user gets redriected to the index and then React Router handles routing to the correct page, Google’s search engine crawler will refuse to index the page as it is a 403.
Is there a way in the Cloudflare settings to rewrite the 403 to a 301?
Or is this something that must be done in S3? ( I had a quick look and I don’t think it’s possible)