I'm attempting to host a static Angular site on AWS S3, but I'm running into a Cross-Origin Resource Sharing (CORS) policy problem. When I try to access the index.html file after executing 'ng build', I encounter this error:
Access to script at '.../dist/testapp/runtime-es2015.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome-untrusted, https, edge.
From my understanding, Angular typically requires a server to run, and I'm struggling to find comprehensive documentation on how to handle this.
I need help in two areas:
- How can I address this CORS policy issue?
- How do I successfully host a static Angular site on AWS S3?
I've looked at similar questions and tried their solutions without any success. They are as follows: