Skip to content

Instantly share code, notes, and snippets.

@eyecatchup
Created September 25, 2020 10:57
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
(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