components: website component doesn't seem to work with SPA (routing issue)

From Josh Strange on Slack #help message:

@eslam Thank you for all your help on github! Could I trouble you/someone else with 1 more (no promises 😆 ) question? My website was correctly deployed and available via cloudfront but it’s a SPA and while it works fine if you visit the root and navigate around it doesn’t work if you then refresh the page (after JS has pushed url state). I’ve seen this behavior before in SPA’s in S3 buckets and wanted to know what the correct way to handle this was when using @serverless/website

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

no sir, YOU rock! 😊

Just keep the feedback coming, I’m always here…

@joshstrange I’ve added the 403 to the list of custom errors. Could you try a redeploy?

@eahefnawy Still deploying (I’ll post back when it’s done) but I can see in CF that it is going to redirect the 404 -> index.html (200) so I think we are good 🙌. All of this serverless stuff is super exciting to work with and while I’ve spent a little over a week just getting stuff into place (and making plenty of mistakes or missteps) I feel like I’m finally ready to hit the ground running.

haha 😅

btw here are the changes since you’re curious (love that!)

https://github.com/serverless-components/website https://github.com/serverless-components/domain

Deploying now, hot damn that was fast! I really appreciate your attention on this!

changes might take a while to reflect, but after deployment you could check your distribution error pages page to make sure the error page was created. Please let me know 😊 (works on my end)

sorry, I mean I published to npm. Will push shortly