HTTP Proxy to enable CORS

3 Sep

On one of the projects i’m working on, i run a webpack-dev-server for a local development server.  I had a problem sending ajax requests to our production server because of the cross site origin policy of my browser (chrome/firefox).
My webpack-dev-server runs on http://localhost:8080 while the api server is http://api.xxxxxx.com:1911.

I tried every possible chrome/firefox CORS enabler plugins, but none worked.
So I decided to write a tiny proxy just for that purpose.

For using it, run ‘npm install hoxy’ and run the script attached with node.
You’ll have to set your browser proxy settings to ‘localhost:8000’.

 

Leave a Reply

Your email address will not be published. Required fields are marked *