Host an Angular.io +8 router SPA in Object Store
Hello, I'm trying to host a SPA made with Angular.io in your Object Storage. All is working fine when I'm accessing the index.html. But when I put a different URL according to my app router config such as '/product/:id' or '/cart' returns me 403 HTTP code because the file does not exist, is rendered by JS. I guess that I need to configure the bucket to point always to the index.html file, but I don't know how to manage that.
Thank you!
2 Replies
Hey there -
I did some research on this, and it looks like another user was running into a similar issue and asked about it here. Some suggestions were given, so I wanted to link you to that post here:
object storage static site not serving index.html when accessed via external domain
It talks about making sure your CNAME records are configured to properly point to your index.html file.
I hope that's helpful - let us know if those suggestions work.
This could an old one, but you can manage it defining as your error page, the 'index.html'. That way you can point always to the index.html and Angular Router can find the location when reloading your browser or using an "a href" HTML tag. Faced this same situation while migrating from AWS S3 to Linode Object Storage.
s3cmd ws-create --ws-index=index.html --ws-error=index.html s3://bucket-name