To be able to view a file from s3, you have to generate a presigned document URL. And to able to view this URL you need to be allowed in s3, otherwise you gonna get CORS issue.

[
    {
        "AllowedHeaders": [],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "http://localhost:3000"
        ],
        "ExposeHeaders": []
    }
]

This post is imported from: https://thebrownbox.hashnode.dev/setting-cors-for-aws-s3-to-view-signed-docs