1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00:00

Configure webpack to proxy requests which avoids CORS issues (#914)

This commit is contained in:
Oscar Hinton
2021-04-05 22:38:21 +02:00
committed by GitHub
parent 12e4b614f5
commit 769c247832
3 changed files with 59 additions and 46 deletions

View File

@@ -157,9 +157,46 @@ const devServer = {
cert: fs.readFileSync('dev-server' + certSuffix + '.pem'),
},
// host: '192.168.1.9',
proxy: {
'/api': {
target: 'http://localhost:4000',
pathRewrite: {'^/api' : ''}
},
'/identity': {
target: 'http://localhost:33656',
pathRewrite: {'^/identity' : ''}
},
'/events': {
target: 'http://localhost:46273',
pathRewrite: {'^/events' : ''}
}
},
hot: false,
};
if (ENV === "production") {
devServer.proxy = {
'/api': {
target: 'https://api.bitwarden.com',
pathRewrite: {'^/api' : ''},
secure: false,
changeOrigin: true
},
'/identity': {
target: 'https://identity.bitwarden.com',
pathRewrite: {'^/identity' : ''},
secure: false,
changeOrigin: true
},
'/events': {
target: 'https://events.bitwarden.com',
pathRewrite: {'^/events' : ''},
secure: false,
changeOrigin: true
}
};
}
const config = {
mode: ENV,
devtool: 'source-map',