DEEPAK SHETTY wrote:
Hi
We have a proxy servlet which proxies requests to downstream servers and
we use HttpClient to implement the proxy. We need to pass the Host and
Port that the user had requested for as the Host header to the
downstream system (which is not aware of the proxy) so
Client -->ProxyServer(http-client)-->DownStream
192.168.0.254(80) --> yadayada:8081
Host header
wanted(192.168.0.254:80)
Now I can use VirtualHost to specify the Host name , but theres no way
to specify the port
(http://www.mail-archive.com/httpclient-user@jakarta.apache.org/msg01357
.html)
Or to use the example from the thread
IP: 192.168.0.254
virtual-host1: yadayada:8081
virtual-host2: blahblah:8082
In order to get a resource form the virtual-host1 do:
bind to 192.168.0.254:8081
GET /some/stuff HTTP/1.1
Host: yadayada:8081
In order to get a resource from the virtual-host2 do:
bind to 192.168.0.254:8082
GET /some/stuff HTTP/1.1
Host: blahblah:8082
However we need the proxy to listen on 192.168.0.254 port 80 (and not
8081 or 8082)
Are there any workarounds possible?
Regards
deepak
Deepak,
There is no such thing as a virtual port.
If the servlet you are writing indeed acts as an HTTP proxy (not to be
confused with a reverse HTTP proxy), then by the HTTP spec requests sent
by the clients to the proxy are supposed to look like that
bind to 192.168.0.254:80
GET http://yadayada:8081/some/stuff HTTP/1.1
Host: yadayada:8081
bind to 192.168.0.254:80
GET http://blahblah:8082/some/stuff HTTP/1.1
Host: blahblah:8082
HttpClient is perfectly capable of generating such requests if
configured properly. There is no need for a 'virtual' port at all
Oleg
*********************************************************
Disclaimer:
The contents of this E-mail (including the contents of the enclosure(s) or
attachment(s) if any) are privileged and confidential material of MBT and
should not be disclosed to, used by or copied in any manner by anyone other
than the intended addressee(s). In case you are not the desired addressee,
you should delete this message and/or re-direct it to the sender. The views
expressed in this E-mail message (including the enclosure(s) or attachment(s)
if any) are those of the individual sender, except where the sender expressly,
and with authority, states them to be the views of MBT.
This e-mail message including attachment/(s), if any, is believed to be free of
any virus. However, it is the responsibility of the recipient to ensure that
it is virus free and MBT is not responsible for any loss or damage arising in
any way from its use
********************************************************
---------------------------------------------------------------------
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]