Timeline for S3 Static Website Hosting Route All Paths to Index.html
Current License: CC BY-SA 4.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 20, 2023 at 17:24 | history | edited | Stephen Ostermiller♦ | CC BY-SA 4.0 |
use example domain, code format example URL, code format file name
|
| Nov 1, 2022 at 5:53 | comment | added | hyeogeon | I chose this solution because my app is server-less and not using cloud-front. But every time I refresh, the main page flickers. Is there any way to make it not flicker? | |
| Aug 27, 2021 at 15:03 | history | edited | Mario Petrovic | CC BY-SA 4.0 |
Syntax highlight
|
| Apr 26, 2020 at 15:40 | comment | added | Priyabrata | There is one best alternative, you can use cloudfront edge with lambda function to handle all routing to index.html | |
| Mar 8, 2018 at 3:32 | comment | added | Vince | This solution worked for me! Is there any docs I can refer to for understanding the syntax of this? | |
| Oct 3, 2017 at 18:02 | comment | added | Jonathon Hill | This approach is necessary if you are using Lambda @ Edge to modify the response (for instance, to add HSTS headers), because Lambda will not run on a 4xx response. | |
| Mar 18, 2017 at 15:06 | review | Suggested edits | |||
| Mar 18, 2017 at 23:15 | |||||
| Jun 3, 2016 at 20:37 | comment | added | hartz89 |
I sure wish I didn't have to do it, but this also works with Angular2, with <ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>. I'm using CloudFront so I also had to point the CloudFront distribution to the website endpoint and not the original S3 REST endpoint.
|
|
| May 23, 2016 at 5:41 | comment | added | Andrew Arnautov | @Andreas here is a solution for multiple apps in subfolders using your own nginx proxy, works with subdomains too and it doesn't need cloudfront stackoverflow.com/questions/16267339/… | |
| Mar 24, 2016 at 15:55 | comment | added | Kyeotic | This appears to be working in Safari now. I coupled the Amazon redirect with Michael Ahlers solution for react router. Safari appears to be working | |
| Mar 7, 2016 at 20:30 | comment | added | Andreas | be careful with this approach if you try to use subdomains at some point. since you have to hardcode the host name into the redirect url that doesn't work anymore. In that case see solution by moha297 | |
| Feb 12, 2016 at 3:24 | comment | added | moha297 | It does not workin safari and is a big problem with the deployment strategy. Writing a small js to redirect is kind of shabby approach. Also, the number of redirects is a problem too. I am trying to figure if there is a way for all S3 urls to point to index.html always. | |
| Nov 2, 2015 at 9:13 | comment | added | Motin |
Thanks, this method works (except for in Safari). To mimic this locally using grunt, use connect-modrewrite, use the following rewrite-rule: ^/([^\\.]+)$ /#!/$1 [NC,NE,R=302]
|
|
| Sep 30, 2015 at 20:08 | comment | added | Santthosh | @JWarner did you ever found out a solution for Safari, I still find this is the case | |
| Sep 24, 2015 at 2:28 | comment | added | Felix D. |
Succeeded with react-router with that solution using HTML5 pushStates and <ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>
|
|
| Aug 9, 2015 at 14:08 | comment | added | Zanon | @MarkNutter, this is the correct solution. Please, accept it. Stefan's answer is misleading. | |
| Jul 4, 2015 at 20:11 | history | edited | typeoneerror | CC BY-SA 3.0 |
edited body
|
| Mar 19, 2015 at 16:15 | comment | added | qmo | Anyone replicated the rule using modrewrite middleware for connect? | |
| Feb 25, 2014 at 23:41 | comment | added | AE Grey |
Thanks! This worked well for me on backbone with a small tweak. I added in a check for older browsers: <script language="javascript"> if (typeof(window.history.pushState) == 'function') { window.history.pushState(null, "Site Name", window.location.hash.substring(2)); } else { window.location.hash = window.location.hash.substring(2); } </script>
|
|
| Jan 21, 2014 at 16:14 | comment | added | clexmond | This will fail with older version of IE if you have GET params included in your urls, correct? How do you get around that issue? | |
| Oct 11, 2013 at 17:20 | comment | added | wcandillon | This solution works great! In fact angularjs will automatically do the history pushState if the html mode is configured. | |
| Jun 1, 2013 at 21:03 | vote | accept | Mark Nutter | ||
| Jun 11, 2013 at 5:19 | |||||
| Jun 1, 2013 at 21:02 | history | answered | Mark Nutter | CC BY-SA 3.0 |