lib
lib copied to clipboard
AWS - Deploy into S3 (locale-router-static)
Ciao, for my needs I am using examples/locale-router-static to generate my static website to upload to the S3 bucket. But I cannot configure S3 correctly.
When I work with a static website that I deploy in S3, I only use a page called index.html as the default index, but in this case, Sveltekit (svelte.config.js) generates more than a single page and I don't know how to configure my s3 bucket.
Could anyone help me with this?
Regards, Christian.
Ciao,
I found a solution...which is not the best but for now works as expected 😄 suppose we have 2 languages like en and en
- in the root of the project we create an empty file called for example index
- run (in my case) npm run build or npx run build
- load the files present in the build folder in s3
- load the empty index file in the root of s3
- click on the index file -> go to Properties -> metadata section and click on edit -> set x-amz-website-redirect-location as /it/ and save
Configuring s3:
- Static website hosting set to true
- index document set to index
- Error document - optional set to en.html
- Redirection rules: optional set to the following:
[ { "Condition": { "HttpErrorCodeReturnedEquals": "/it" }, "Redirect": { "ReplaceKeyWith": "/it/" } }, { "Condition": { "HttpErrorCodeReturnedEquals": "/en" }, "Redirect": { "ReplaceKeyWith": "/en/" } } ]
Remember that the more languages there are, the more rules you have to add. I hope this can help someone.
Christian