41.4. Handling HTTP Headers
camel-http), but also a number of other HTTP-based components, including:
camel-http camel-http4 camel-jetty camel-restlet camel-cxf camel-cxfrs
HTTP headers in Camel CXF
HTTP consumer endpoint
- Several headers with the
CamelHttpprefix are created, which record the status of the incoming message. For details of these internal headers, see HTTP.
- HTTP headers
- All of the HTTP headers from the original incoming message are mapped to headers on the exchange's In message.
- URL options (Jetty only)
- The URL options from the original HTTP request URL are mapped to headers on the exchange's In message. For example, given the client request with the URL,
http://myserver/myserver?orderid=123, a Jetty consumer endpoint creates the
orderidheader with value
HTTP producer endpoint
- Headers prefixed by
CamelHttpare used to control the behaviour of the HTTP producer endpoint. Any headers of this kind are consumed by the HTTP producer endpoint and the endpoint behaves as directed.NoteHowever,
CamelHttpmessage headers are ignored by Camel CXF producer endpoints (but not by Camel CXF-RS producer endpoints).
- All other headers prefixed by
Camelare presumed to be meant for internal use and are not mapped to HTTP headers in the target message (in other words, these headers are ignored).
- All other headers are converted to HTTP headers in the target message, with the exception of the following headers, which are blocked (based on a case-insensitive match):
content-length content-type cache-control connection date pragma trailer transfer-encoding upgrade via warning
Implications for HTTP bridge applications
CamelHttp*headers set by the consumer endpoint at the start of the route can affect the behavior of the producer endpoint. For this reason, in a bridge application it is advisable to remove the
CamelHttp*headers, as follows:
from("http://0.0.0.0/context/path") .removeHeaders("CamelHttp*) ... .to("http://remoteHost/context/path");
Setting a custom header filter
headerFilterStrategyoption on the endpoint URI. For example, to configure a producer endpoint with the
myHeaderFilterStrategyfilter, you could use a URI like the following:
myHeaderFilterStrategyis the bean ID of your custom filter instance.