From b6bf53f4578b5ffbeab62e4bcaf3b4dbda85fdc7 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 13 Jun 2017 19:29:05 +0100 Subject: [PATCH] [ADF-804] webpack proxy setup to avoid CORS problem (#1960) --- demo-shell-ng2/app/app.component.ts | 4 ++-- demo-shell-ng2/config/webpack.common.js | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/demo-shell-ng2/app/app.component.ts b/demo-shell-ng2/app/app.component.ts index 492a0facc4..e63ee99572 100644 --- a/demo-shell-ng2/app/app.component.ts +++ b/demo-shell-ng2/app/app.component.ts @@ -29,8 +29,8 @@ declare var document: any; export class AppComponent { searchTerm: string = ''; - ecmHost: string = 'http://' + window.location.hostname + ':8080'; - bpmHost: string = 'http://' + window.location.hostname + ':9999'; + ecmHost: string = `http://${window.location.hostname}:${window.location.port}/ecm`; + bpmHost: string = `http://${window.location.hostname}:${window.location.port}/bpm`; constructor(private authService: AlfrescoAuthenticationService, private router: Router, diff --git a/demo-shell-ng2/config/webpack.common.js b/demo-shell-ng2/config/webpack.common.js index a06454f79a..267c816ffd 100644 --- a/demo-shell-ng2/config/webpack.common.js +++ b/demo-shell-ng2/config/webpack.common.js @@ -129,7 +129,29 @@ module.exports = { port: 3000, historyApiFallback: true, host: '0.0.0.0', - inline: true + inline: true, + proxy: { + '/ecm': { + target: { + host: "0.0.0.0", + protocol: 'http:', + port: 8080 + }, + pathRewrite: { + '^/ecm': '' + } + }, + '/bpm': { + target: { + host: "0.0.0.0", + protocol: 'http:', + port: 9999 + }, + pathRewrite: { + '^/bpm': '' + } + } + } }, node: {