UNPKG

1.37 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getProxyConfig = getProxyConfig;
4function getProxyConfig(url) {
5 return [
6 {
7 target: url,
8 ws: true,
9 secure: false,
10 changeOrigin: true,
11 timeout: 120000,
12 proxyTimeout: 120000,
13 path: ['**'],
14 /**
15 * The following two lines are used to allow to use cookie-auth
16 * also in un-secure environments like local-development. It removes
17 * the secure flag and rewrites the domain for the cookie.
18 *
19 * You should never use this setting in production!
20 */
21 cookieDomainRewrite: 'localhost',
22 /**
23 * Excluding request for live reload and HMR from angular
24 */
25 context: function (path) {
26 return !path.match(/\/ng-cli-ws/);
27 },
28 onProxyRes: proxyResponse => {
29 'use strict';
30 if (proxyResponse.headers['set-cookie']) {
31 const cookies = proxyResponse.headers['set-cookie'].map(cookie => cookie.replace(/;\s{0,}secure/gi, ''));
32 proxyResponse.headers['set-cookie'] = cookies;
33 }
34 }
35 }
36 ];
37}
38//# sourceMappingURL=proxy.js.map
\No newline at end of file