DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=38196>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=38196 Summary: Provide access to port of Host header Product: HttpClient Version: 3.0 Final Platform: Other URL: http://marc.theaimsgroup.com/?t=113647183600002&r=1&w=2 OS/Version: other Status: NEW Severity: enhancement Priority: P2 Component: Commons HttpClient AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] We use a load balancer that connects to the HTTP server and the HTTP server connects to the application server. We use port translation in our load balancer. So when e.g. a client connects to 90 of the load balancer, the load balancer connects to port 100 of the HTTP server. The load balancer doesn't change the Host request header, so in the host request header is still the original virtual host name and port, in this case port 90. For this reason, the virtual hosts of the HTTP server and application server are configured based on the external port numbers, so in this case port 90. For test purposes, we sometimes want to connect directly to the HTTP server or the application server, bypassing the load balancer. To do this, we need to connect to the same port as the load balancer would, in this example port 100, but the host header of this request should be the same as if the request would go through the load balancer, so in this example port 90, because the HTTP server and application server's virtual hosts are configured for this port. The attached patch adds the possibility to specify the port number for virtual hosts. Here's a code snippet that uses the patched code: HttpClient httpClient = new HttpClient(); HttpMethod method = new GetMethod(); HostConfiguration hostConfiguration = new HostConfiguration(); hostConfiguration.setHost("localhost", 80, "http"); HostParams params = new HostParams(); params.setVirtualHost("localhost"); params.setVirtualHostPort(100); hostConfiguration.setParams(params); httpClient.executeMethod(hostConfiguration, method); System.out.println(method.getResponseBodyAsString()); method.releaseConnection(); -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
