I hosted my local files with http server. Just install on my Mac HTTP server with command:
npm install --global http-server
Then I start this server in needed directory with the command:
http-server
I had the CORS policy problem when trying to fetch my local HTML file from HTTP server response. It was blocked.

All I need to do for resolving this issue just to start HTTP server with cors option:
http-server --cors
One of the possible solutions is simply serve package via npx
eg. npx serve ./folder -l 3003 --cors
The port can be dropped or specified
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With