Reputation: 1572
I'm using an SPA and my local dev environment serves the index.html file for any 404s. This keeps the URL intact when loading the app. My apps routing picks up the URL and displays the correct page.
I currently have 404 redirects in s3 to index.html
Current behavior
Desired behavior
I'm hoping I can achieve this without needing to run a server
Upvotes: 1
Views: 1024
Reputation: 36073
If you configure index.html
for both Index Document and Error document with no redirects configured, then:
www.example.com
shows www.example.com/index.html
with 200 status code, client sees www.example.com
.www.example.com/sub1
(found) shows www.example.com/sub1/index.html
with 200 status code, client sees www.example.com/sub1
with no redirect.www.example.com/sub1
(not found) shows www.example.com/index.html
with 404 status code, client sees www.example.com/sub1
with no redirect.There is no way to change this behaviour. If you want it different, then you'll need to use your own server.
Upvotes: 2