Skip to content

Instantly share code, notes, and snippets.

@eyecatchup
Created September 25, 2020 10:57
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