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.
@@ -5,6 +5,7 @@ export declare class HttpProxyMiddleware<TReq, TRes> {
5
5
  private proxyOptions;
6
6
  private proxy;
7
7
  private pathRewriter;
8
+ private logger;
8
9
  constructor(options: Options<TReq, TRes>);
9
10
  middleware: RequestHandler;
10
11
  private registerPlugins;
@@ -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
- return (0, path_filter_1.matchPathFilter)(pathFilter, req.url, req);
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "http-proxy-middleware",
3
3
  "type": "commonjs",
4
- "version": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "description": "The one-liner node.js proxy middleware for connect, express, next.js and more",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",