Skip to content

Instantly share code, notes, and snippets.

@eyecatchup
Created September 25, 2020 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyecatchup/b179cd83922ee346ccca95f6d7de0976 to your computer and use it in GitHub Desktop.
Save eyecatchup/b179cd83922ee346ccca95f6d7de0976 to your computer and use it in GitHub Desktop.
(Vue.js) Webpack dev server config to use a (corporate) proxy
const HttpsProxyAgent = require('https-proxy-agent')
const proxy = new HttpsProxyAgent('http://1.2.3.4:3128')
module.exports = {
// ...
configureWebpack: {
devServer: {
// ...
proxy: {
'/api/*': {
target: 'https://your-remote-backend.com',
ws: true,
changeOrigin: true,
agent: proxy
}
}
}
}
}
const HttpsProxyAgent = require('https-proxy-agent')
const proxy = new HttpsProxyAgent('http://1.2.3.4:3128')
module.exports = (env) => ({
// ...
devServer: {
// ...
proxy: {
'/api/*': {
target: 'https://your-remote-backend.com',
ws: true,
changeOrigin: true,
agent: proxy
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment