http-proxy-middleware 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,6 +9,7 @@ const PathRewriter = require("./path-rewriter");
|
|
|
9
9
|
const Router = require("./router");
|
|
10
10
|
const debug_1 = require("./debug");
|
|
11
11
|
const function_1 = require("./utils/function");
|
|
12
|
+
const logger_1 = require("./logger");
|
|
12
13
|
class HttpProxyMiddleware {
|
|
13
14
|
constructor(options) {
|
|
14
15
|
this.wsInternalSubscribed = false;
|
|
@@ -69,7 +70,14 @@ class HttpProxyMiddleware {
|
|
|
69
70
|
* Determine whether request should be proxied.
|
|
70
71
|
*/
|
|
71
72
|
this.shouldProxy = (pathFilter, req) => {
|
|
72
|
-
|
|
73
|
+
try {
|
|
74
|
+
return (0, path_filter_1.matchPathFilter)(pathFilter, req.url, req);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
(0, debug_1.Debug)('Error: matchPathFilter() called with request url: ', `"${req.url}"`);
|
|
78
|
+
this.logger.error(err);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
73
81
|
};
|
|
74
82
|
/**
|
|
75
83
|
* Apply option.router and option.pathRewrite
|
|
@@ -122,6 +130,7 @@ class HttpProxyMiddleware {
|
|
|
122
130
|
};
|
|
123
131
|
(0, configuration_1.verifyConfig)(options);
|
|
124
132
|
this.proxyOptions = options;
|
|
133
|
+
this.logger = (0, logger_1.getLogger)(options);
|
|
125
134
|
(0, debug_1.Debug)(`create proxy server`);
|
|
126
135
|
this.proxy = httpProxy.createProxyServer({});
|
|
127
136
|
this.registerPlugins(this.proxy, this.proxyOptions);
|
package/package.json
CHANGED