Deploying my ui artifacts to my s3 bucket

0

I have built a stack with an s3 bucket and made the bucket public and have enabled the bucket for static website hosting so that I have an endpoint to be able to spin out my project. When I run an ng build on my stack locally, it creates a dist folder with directories and files. One of the directories is a 'browser' directory that has my my index.html file in it along with other files. When i deploy my stack to AWS, it will deploy everything in the dist folder. The trouble is my the index.html file and other files are buried in the 'browser' directory so that when i try to access my bucket endpoint, it says it can't find the index.html file.
What changes do i need to make so that my index.html file is not buried in my browser directory in the dist folder or my endpoint can find the index.html file in the dist/browser directory located in my s3 bucket?

Kerry
已提问 2 个月前139 查看次数
1 回答
2

If your index.html file is located in some folder, you can set it in the browser when you access your website Enter image description here

Or you can try a redirection rule in the S3 web hosting configuration
https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html#redirect-rule-examples

for example:

[
    {
        "Condition": {
            "KeyPrefixEquals": "index.html"
        },
        "Redirect": {
            "HttpRedirectCode": "302",
            "ReplaceKeyPrefixWith": "dist/browser/index.html"
        }
    }
]

redirection rule

profile picture
专家
已回答 2 个月前
profile picture
专家
Artem
已审核 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则