Commit 8d269814 authored by Matija Obreza's avatar Matija Obreza

Proxy: changeOrigin is required

parent 95a4df69
......@@ -27,7 +27,7 @@
"clean": "rimraf target",
"build": "yarn run generateI18n && rimraf target && yarn run build:production && yarn run build:server",
"build:production": "cross-env NODE_ENV=production SSR=true webpack --config config/webpack-production.config.js",
"build:server": "cross-env NODE_ENV=production SSR=true webpack --config config/server.config.js",
"build:server": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=8192 SSR=true webpack --config config/server.config.js",
"serve": "yarn run generateI18n && cross-env NODE_OPTIONS=--max_old_space_size=8192 webpack-dev-server --config config/webpack-development.config.js",
"serve:production": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=8192 webpack-dev-server --config config/webpack-production.config.js",
"serve:ssr": "yarn run build && cd target/app/server && cross-env SSR=true node server.js",
......@@ -183,6 +183,7 @@
"webpack-dev-server": "^3.11.0",
"webpack-hot-middleware": "^2.25.0",
"webpack-manifest-plugin": "^2.2.0",
"webpack-merge": "^4.2.2"
"webpack-merge": "^4.2.2",
"rimraf": "^3.0.1"
}
}
......@@ -20,6 +20,15 @@ const filter = (path: string, req: Request) => {
const options = {
target: config.apiUrl,
changeOrigin: true,
onError(err, req, res) {
console.log(`Proxy error`, err);
res.writeHead(500, {
'Content-Type': 'text/plain',
});
res.end('Something went wrong. And we are reporting a custom error message.');
},
pathRewrite: (path: string, req: Request) => {
// console.log('path', path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment