File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,9 @@ module.exports = function (urls) {
47
47
// If routing to a server on another domain, the hostname in the request must be changed.
48
48
req . headers . host = m . host ;
49
49
// Once any changes are taken care of, this line makes the magic happen.
50
- proxy . proxyRequest ( req , res , m . dest ) ;
50
+ return proxy . proxyRequest ( req , res , m . dest ) ;
51
51
}
52
52
}
53
+ next ( ) //did not have a rule for this request. fall back to next middleware.
53
54
}
54
55
}
Original file line number Diff line number Diff line change
1
+ #proxy by url
2
+
3
+ this is a simple example of a node-http-middleware that will proxy based on the incoming url.
4
+ say you want to proxy every request thing under /database to localhost:5984 (couchbd)
5
+ (and remove the /database prefix)
6
+
7
+ this is how:
8
+
9
+ require('http-proxy').createServer(
10
+ require('proxy-by-url')({
11
+ '/database': { port: 5984, host: 'localhost' },
12
+ })
13
+ ).listen(8000)
You can’t perform that action at this time.
0 commit comments