camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward Welch (JIRA)" <>
Subject [jira] [Commented] (CAMEL-9462) HTTP 1.1 Host header be dealt wrongly in proxy & load balancer
Date Wed, 06 Apr 2016 20:58:25 GMT


Edward Welch commented on CAMEL-9462:

I have a fix for this issue, however before submitting the PR I have a question.

I tried to apply the fix to both the HTTP (http client 3) and HTTP4 (http client 4) components,
however, it turned out to not really be feasible to make this fix on the HTTP component as
it is very difficult to override the Host header which is auto set.  In 4 they made this much

Given that http client 3 is pretty much end of life, I decided to not spend any more time
on trying to see if it was even possible to do this.

Here's my question, I added my new parameter to the HttpCommonEndpoint which I believe to
be used by both the HTTP and HTTP4 components.  Is this ok?  Should I add something in the
description indicating it will only work for HTTP4?  Or should I move the parameter to the
HTTP4 HttpEndpoint subclass?

> HTTP 1.1 Host header be dealt wrongly in proxy & load balancer
> --------------------------------------------------------------
>                 Key: CAMEL-9462
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http, camel-http4
>    Affects Versions: 2.9.5, 2.10.3, 2.11.0
>            Reporter: Ian Hu
>             Fix For: 2.17.1, 2.18.0
> I have wrote code below make camel as a load balancer, but camel-http4(and the camel-http,
etc) deal the http header Host wrongly, it replace the Host header with the host name of the
backend of balancer, that make the backend generate the wrong link.
> {|borderStyle=solid}
> import org.apache.camel.impl.DefaultCamelContext;
> import org.apache.camel.model.RouteDefinition;
> public class Main {
>     public static void main(String[] args) throws Exception {
>         DefaultCamelContext context = new DefaultCamelContext();
>         RouteDefinition route = new RouteDefinition();
>         route.from("jetty:")
>                 .loadBalance().roundRobin()
>                 .to("http4://")
>                 .to("http4://");
>         //
>         context.addRouteDefinition(route);
>         context.start();
>     }
> }
> {code}
> I have view the code and found a fix of [](See
the commit), it's commits simply removed the host header [].
and I really do not think it should be dealt like that.
> Some backend will use the Host header to generate link, and when the Host header removed
and then it be set to the backend's host, the backend got the wrong Host, and generate the
wrong link.
> I expect the link should be http://localhost:8080/web but it generate
or when I view the page with the url http://localhost:8080

This message was sent by Atlassian JIRA

View raw message