Camel undertow does not give an option to change the "Host" header when calling another HTTP endpoint.

Solution Verified - Updated -

Issue

  • If two HTTP services are proxied using camel undertow, it always keeps the Host header received from the first service and does not allow to change it. This can be problematic in situations where the target service validates the Host header.
  • Camel undertow always propagates the same host header from source to target. There is no option to disable this.

<route> <from uri="undertow:http://localhost:8189"/> <log message="Source ${in.headers.Host}" /> <to uri="undertow:http://localhost:8289"/> </route> <route> <from uri="undertow:http://localhost:8289"/> <log message="Target ${in.headers.Host}" /> </route>

Result:


2019-11-05 12:43:54.738 INFO 30967 --- [ XNIO-2 task-1] route1 : Source localhost:8189 2019-11-05 12:43:54.789 INFO 30967 --- [ XNIO-3 task-1] route2 : Target localhost:8189

Expected:

2019-11-05 12:43:54.738  INFO 30967 --- [  XNIO-2 task-1] route1 :  Source localhost:8189
2019-11-05 12:43:54.789  INFO 30967 --- [  XNIO-3 task-1] route2 :  Target localhost:8289

Environment

  • Red Hat Fuse
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content