camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Host header not set correctly with camel-http4
Date Mon, 29 Oct 2012 09:14:16 GMT
On Fri, Oct 26, 2012 at 9:01 PM, Maxime Tremblay
<maximetremblay@acprail.com> wrote:
> Hi All,
>
> I just have to switch to camel-http4 for some request proxying whit
> bridgeEnpoint=true.
>
> Now I have the problem that the Host header is not set correctly in the
> HTTP request.
> The original Host is put instead of the target Host.
>
> Everything was working fine with camel-http.
> And I cannot find how to explicitly set the Host, neither in the doc or the
> the source code.
>

I would assume using <setHeader
headerName="Host"><constant>Foo</constant></setHeader> would override
the header.
Or even just remove it.

But I guess we should fix it so it work out of the box. Fell free to
log a JIRA ticket.
And as always patches is welcome.
http://camel.apache.org/contributing.html


> This simple route shows the problem:
>
>  <route autoStartup="true" id="TestHost" xmlns:ns2="
> http://camel.apache.org/schema/web" xmlns="
> http://camel.apache.org/schema/spring">
>         <from uri="jetty:http://0.0.0.0:8090/TestHost"/>
>         <to uri="https4://
> www.google.com?bridgeEndpoint=true&amp;throwExceptionOnFailure=false<http://www.google.com?bridgeEndpoint=true&throwExceptionOnFailure=false>
> "/>
>  </route>
>
> This is what I get in the log:
>
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> DefaultClientConnection        DEBUG Sending request: GET / HTTP/1.1
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "GET / HTTP/1.1[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "breadcrumbId:
> ID-EROS-1329-1351277552803-0-2[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "User-Agent: Mozilla/5.0 (Windows
> NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "Accept-Encoding: gzip,
> deflate[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "Host: 10.0.0.6:8090[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "Accept:
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "Accept-Language:
> en-us,en;q=0.5[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "Connection: Keep-Alive[\r][\n]"
> INFO   | jvm 1    | 2012/10/26 14:52:48 | [    qtp31541880-35 - /TestHost]
> wire                           DEBUG >> "[\r][\n]"
>
> It is problematic in some authentication scenario, were the Host is
> verified by the server.
>
> Anyone knows how to get the target host in the Host header of the request
> sent ?
>
> Many thanks,
>
> Max



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message