You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-54
Original file line number
Diff line number
Diff line change
@@ -10,20 +10,40 @@ Node.js proxying made simple. Configure proxy middleware with ease for [connect]
10
10
11
11
Powered by the popular Nodejitsu [`http-proxy`](https://github.com/nodejitsu/node-http-proxy). [](https://github.com/nodejitsu/node-http-proxy)
12
12
13
+
## ⚠️ NOTE
14
+
15
+
This page is showing documentation for version v1.x.x
For fine-grained control you can use wildcard matching. Glob pattern matching is done by _micromatch_. Visit [micromatch](https://www.npmjs.com/package/micromatch) or [glob](https://www.npmjs.com/package/glob) for more globbing examples.
159
179
160
-
-`proxy('**', {...})` matches any path, all requests will be proxied.
161
-
-`proxy('**/*.html', {...})` matches any path which ends with `.html`
162
-
-`proxy('/*.html', {...})` matches paths directly under path-absolute
163
-
-`proxy('/api/**/*.html', {...})` matches requests ending with `.html` in the path of `/api`
@@ -248,9 +270,9 @@ Providing an alternative way to decide which requests should be proxied; In case
248
270
```javascript
249
271
// verbose replacement
250
272
functionlogProvider(provider) {
251
-
var logger =new (require('winston').Logger)();
273
+
constlogger=new (require('winston').Logger)();
252
274
253
-
var myCustomProvider = {
275
+
constmyCustomProvider= {
254
276
log:logger.log,
255
277
debug:logger.debug,
256
278
info:logger.info,
@@ -272,9 +294,7 @@ Subscribe to [http-proxy events](https://github.com/nodejitsu/node-http-proxy#li
272
294
res.writeHead(500, {
273
295
'Content-Type':'text/plain'
274
296
});
275
-
res.end(
276
-
'Something went wrong. And we are reporting a custom error message.'
277
-
);
297
+
res.end('Something went wrong. And we are reporting a custom error message.');
278
298
}
279
299
```
280
300
@@ -401,14 +421,14 @@ The following options are provided by the underlying [http-proxy](https://github
401
421
Use the shorthand syntax when verbose configuration is not needed. The `context` and `option.target` will be automatically configured when shorthand is used. Options can still be used if needed.
In the previous WebSocket examples, http-proxy-middleware relies on a initial http request in order to listen to the http `upgrade` event. If you need to proxy WebSockets without the initial http request, you can subscribe to the server's http `upgrade` event manually.
448
465
449
466
```javascript
450
-
var wsProxy =proxy('ws://echo.websocket.org', { changeOrigin:true });
0 commit comments