Make sure you have Node.js and npm installed. You can download them from nodejs.org.
-
Using npx you can run the script without installing it first:
cd /path/to/your/project npx http-server
-
Open your browser and go to
http://127.0.0.1:8080/
to see your content ofindex.html
.
- Click on network call which is failing because of CORS issue & right click on it.
- Click on
Override Headers
option on it. Ref.{:height="36px" width="36px"}
- Click on
.Headers
option Ref. - Click on
Add override rule
button. Ref. - Add header
Access-Control-Allow-Origin
as*
for all. Ref. - Keep the devtool open to keep the above changes effective.
For more options and configurations, refer to the http-server documentation.