You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Phoebe Shao <ph...@gmail.com> on 2007/03/30 22:16:28 UTC

Over writing the host header with port

Is there a way to set the port in the Host header to a port that is
different from the port in the URI?    I tried setVirtualHost but that sets
the host part only and port is still the port in the URI.

For example:

HttpClient client = new HttpClient();
PostMethod postMethod =  new PostMethod("localhost:8888");
client.getParams().setVirtualHost("my.realhost.com:80");

The above will set the Host header as:
Host: my.realhost.com:8888

How can I set it to Host: my.realhost.com:80 ?

I need to do this because of I need to use ssh port forwarding to access a
server which is only accessible from a certain IP.

Thanks,

Phoebe

Re: Over writing the host header with port

Posted by Roland Weber <ht...@dubioso.net>.
Hello Phoebe,

you will have to modify HttpClient code. This issue
includes a patch for an older release of HttpClient:

https://issues.apache.org/jira/browse/HTTPCLIENT-547

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org