node.jscorsnpm-live-server

How can I set response headers in live-server to avoid CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource?


I am creating my personal website, and I am using live-server, but I get the CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource error. So I review the documentation, and they recommend adding --cors flag to enable cors for any origin, I did it, but the same error appears.

By the way, that's happened, especially with the font awesome script kit.

Any solutions do you want to provide me? Thanks before all.


Solution

  • Are these HTML tags? Add crossorigin attribute to the end of your script tag then.