-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect loop #207
Comments
Could you please provide either an MRE/reprex, or what your |
If you are getting 403 errors, that suggests your Origin is not configured correctly in CloudFront. Please see this recipe, especially particularly the two "CloudFront setup" paragraphs. When CloudFront is correctly set up to use the S3 Static Website Hosting endpoint you shouldn't need any error behaviour in CloudFront. Instead, leverage the error document functionality if S3 Static Website Hosting. |
Same issue for me here when I refresh a client-paths I get a redirect loop. I tried with the workaround suggested by @webjay and it's working. The configuration is almost identical
On CloudFront, I'm using the bucket website endpoint as suggested in the recipe, if I navigate to the bucket website endpoint everything is working (file are public) but the same redirect issue happens @webjay did you by any chance found a solution for that? |
I just realized that the workaround is working because wildcards are not supported and 404.index page is returned which basically handles the redirection to the correct page I made an experiment with the following configuration where:
As you can see here seems to be working fine now: @JoshuaWalsh Do you see any potential issue with this approach, I can create a PR, in any case, I will fork it to avoid manual steps |
The potential issue I can see here is an SEO one. Relying on 404 means that search engines will not list clientside routes (maybe desirable) and that links to clientside routes would be classified as broken, which could penalise the page the link is found on. (Probably bad) You could use a CloudFront error behaviour to rewrite 404 to 200, but this means that actual broken links will now return as 200, which is also bad. (For one thing, it means broken link scanning tools will no longer work) Doing a 302 redirect for client routes is also far from ideal, as discussed in #77. I can't think of any way to solve this elegantly other than to use Lambda@Edge. |
I think my example was a bit confusing my current, please ignore invite it was just a counterexample.
For non-existing URL returning 200 may not be desirable but I think this can't be avoided even with the actual gatsby-plugin-s3 configuration, probably you would have the same behaviour on Netlify. |
I have been using your great plugin for a while.
I can't say when it happened, but dynamic paths, via
gatsby-plugin-create-client-paths
, has started going into a redirect loop, if the page is reloaded in the browser. Navigating to the page from another page doesn't cause a redirect loop.If I in S3 change
KeyPrefixEquals
fromavailability/
toavailability/*
andReplaceKeyWith
fromavailability
to
availability/
, the redirect loop doesn't happen.This works:
The text was updated successfully, but these errors were encountered: