Comments (5)
I think you want
var proxy = require('express-http-proxy');
var app = require('express')();
app.use('/proxy', proxy(function (req) {
return req.session.dynamic_host;
})).listen(8080);
console.log("listening on port 8080")
from express-http-proxy.
I added a test to show this working (a16ff72). Hope this helps.
from express-http-proxy.
@monkpow Thank you very much
from express-http-proxy.
@monkpow this actually doesn't allow for a different host for each request, if I'm not mistaken.
Due to this line https://github.com/villadora/express-http-proxy/blob/master/index.js#L38 if I understand correctly the parsedHost
variable will be initialized on the first request and then won't change even if parseHost
would return a different host for subsequent requests.
from express-http-proxy.
@monkpow I've actually open a pull request with a test which demonstrates the issue and a fix which should solve it.
#134
from express-http-proxy.
Related Issues (20)
- memoizeHost option not working
- Can't update path with proxyReqPathResolver HOT 2
- Make the user request available in proxyErrorHandler
- proxyReqBodyDecorator value is not returned if parseReqBody == false
- DNS_PROBE_FINISHED_NXDOMAIN HOT 1
- ERR_HTTP_HEADERS_SENT when setting parseReqBody=true HOT 1
- form-urlencoded requests do not proxy correctly if content-type contains a semi-colon HOT 2
- Is this project still alive? Any alternatives? HOT 3
- "range" header is copied from container options even though it should be transitory
- Can I prevent express-http-proxy from unescaping string characters? HOT 1
- HTTP proxy HOT 2
- Can't use `proxy()` twice in an Express middleware stack HOT 11
- proxyReqOptDecorator not setting headers as described HOT 1
- How to use
- Major usability issue without `decorateRequest` HOT 1
- Tracking the response time HOT 1
- DeprecationWarning: OutgoingMessage.prototype._headers is deprecated *again* HOT 1
- SNI does not get set in outgoing connections
- Unable to change 'content-type' header of request HOT 2
- Unable to remove default charset from "content-type" response header
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-http-proxy.