2 Respuestas
- Más nuevo
- Más votos
- Más comentarios
0
Hi,
Do you really need to expose all these folders instead of only /pages/
? If not, I would suggest to either do not upload them to S3 during the deployment or/and use Origin path
set.
0
Hi,
You can use cloudfront function to re-write the URL and fullfill your requirement. Please take a look at the following links for more detailed information.
https://github.com/aws-samples/amazon-cloudfront-functions/tree/main/url-rewrite-single-page-apps
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example-function-add-index.html
Hope this helps.
respondido hace 8 meses
Thanks for the tip.
Contenido relevante
- OFICIAL DE AWSActualizada hace 4 meses
- OFICIAL DE AWSActualizada hace un año
Hello Well, i have started from /pages deploy, but there is an issue, that this folder does not include all the neccessary files for this app. For example /img and other, and as a result deployment site looks ugly. That is why i have tried to deploy ./next folder instead, but it has no strict structure (like should be in artefact folder). Also i tried to run "npx next export" but it generates only pages folder without any other needed. So i suppose there is an issue with export. But the strange thing is that ./next folder works perfectly in AWS amplify but doesn`t work properly on cloudfront.
Take a look if this instruction helps https://gist.github.com/rbalicki2/30e8ee5fb5bc2018923a06c5ea5e3ea5