domingo, 11 de julio de 2021

Deploy and SPA and getting 404 errors? WTFs that become normal

So, deploying an SPA to an S3 bucket, or github pages involves hacking your way around 404's.  

I did not know this one previously, but once you understand what happens under the hood, it makes sense, the web file server can't understand about any kind of paths besides index.html.  What feels strange is that the "official" ways of deploying such "modern" apps feels like it's using a hack, relying on this catch-all solution of overwriting the 404 page to serve index.html (and potentially hacking it's router), or create an ad-hoc 404.html page and put the hack there.  

Finding all info in random blogposts, stackoverflow threads, gists.... The whole thing seems so fishy... but I've come assume that it's just the way it is. That's the full story. Accept it and move on to more interesting things (like fighting CORS or Same-Site Cookies on buggy browsers)

  • https://github.com/rafgraph/spa-github-pages
  • https://medium.com/swlh/how-to-host-your-angular-reactjs-vuejs-spa-on-github-pages-2d9ab102ac7b
  • https://dev.to/alexeyromanchenko/how-to-deploy-spa-as-a-static-website-using-aws-s3-1adg
  • https://gist.github.com/bradwestfall/b5b0e450015dbc9b4e56e5f398df48ff
  • https://johnlouros.com/blog/using-CloudFront-to-serve-an-SPA-from-S3



No hay comentarios: