Yes, I have tried out doing that too. 

Say, I am running my reverse proxy on 10.10.10.10:8888. And I need to
proxy 2 web servers 10.10.10.51(on https) and 10.10.10.52(on http).

So in my browser I have to use the address:
http://10.10.10.10:8888/index.html to get going through the reverse
proxy. When the request comes into my proxy, the 'Host' header will have
the value '10.10.10.10:8888' and this will not help me choose which of
the two target servers I should send my request to.

Also, say if I choose to send the request to the server 10.10.10.51
(which is on https) by default using the HttpClient, and if there is any
Redirect to some page say /settings.html, then the Redirect location
that gets created is "https://10.10.10.10:8888/settings.html"; which is
not right as I wouldn't have https running on the port 8888 on my
reverse proxy system. Then I start getting the exception
[javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection? ]
This happens when I have the Host header in the request while executing
it using the HttpClient like httpClient.execute(targetHost, request)
even though targetHost instance was created as shown below.

targetHost = new HttpHost("10.10.10.51", 443, "https");

However, this works fine when I remove the Host header from the request
before executing it. That means, the Host header value supercedes the
HttpHost values while creating the Location header value in case of a
redirect.
I hope the above behavior is correct.

Please let me know if there is another way of multiplexing (on the
HttpService side) or should I be using the Host header in some other way
to achieve this?

Thanks,
Brijesh



-----Original Message-----
From: Oleg Kalnichevski [mailto:[email protected]] 
Sent: Wednesday, April 08, 2009 1:32 PM
To: HttpComponents Project
Subject: [Junk released by Allow List] Re: How to proxy multiple web
servers?

On Wed, Apr 08, 2009 at 09:24:21AM +0200, Ortwin Gl?ck wrote:
> Brijesh Deo wrote:
> > So, going by the above
> > approach, I would need to run multiple HttpServices on different
ports
> > to proxy each web server. 
> 
> Brijesh,
> 
> Why don't you use the Host header for multiplexing? That's how evey
shared
> webhosting out there works.
> 

Spot on.

Oleg

> Cheers,
> 
> Ortwin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to