0

I'm trying to get in touch with Apache Camel, but it's behaviour is so far confusing.

For example, I'm using platformHttp and declare a route under which my endpoint should be available.

from(platformHttp("/api/test"))
     .to("https:google.com?bridgeEndpoint=true")
     .setBody(simple("${body}"));

Calling it will call the sub-route https://google.com/api/test instead of https://google.com

Why is that and how would I prevent Apache Camel from taking the route and appending it to the called route in my .to() ?

Marian Klühspies
  • 15,824
  • 16
  • 93
  • 136

1 Answers1

2

To prevent the HTTP exchange headers (I.e ones with names prefixed with CamelHttp) being propagated from the platform-http endpoint to the http endpoint, you can remove them like this.

from(platformHttp("/api/test"))
     .removeHeaders("CamelHttp*")
     .to("https:google.com?bridgeEndpoint=true")
     .setBody(simple("${body}"));

There's an FAQ article for this topic on the Camel website:

https://camel.apache.org/manual/faq/how-to-remove-the-http-protocol-headers-in-the-camel-message.html

James Netherton
  • 1,092
  • 1
  • 7
  • 9