Skip to content

Instantly share code, notes, and snippets.

@unicornist
Last active April 22, 2018 18:09
Show Gist options
  • Save unicornist/ae1ea7b65fad5d3aa8c2db22d1a2681e to your computer and use it in GitHub Desktop.
Save unicornist/ae1ea7b65fad5d3aa8c2db22d1a2681e to your computer and use it in GitHub Desktop.
BrowserSync Proxy /api to backend to prevent CORS errors
npm i http-proxy-middleware --save

Then add this inside server prop of your BrowserSync config object:

middleware: [require('http-proxy-middleware')('/api', {target: 'http://localhost:8020/'})]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment