Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the asciidoc in the repository: https://github.com/apache/camel/blob/master/README.md https://github.com/apache/camel/blob/master/components/readme.adoc
How to use Camel as a HTTP proxy between a client and serverYou may have an existing HTTP service, which you want to use Camel in between as a proxy, between the client and the server. This can be done using the Jetty component as follows:
<route>
<from uri="jetty:http://0.0.0.0:8080/myapp?matchOnUriPrefix=true"/>
<to uri="jetty:http://realserverhostname:8090/myapp?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
</route>
In the example above, we expose a HTTP service on localhost (0.0.0.0 means to expose on all network interfaces) port 8080, and using context path "myapp". Then we route to the You can also use Servlet instead of Jetty, for example:
<route>
<from uri="servlet:myapp?matchOnUriPrefix=true"/>
<to uri="http://realserverhostname:8090/myapp?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
</route>
More control of url mappingsFrom Camel 2.11 onwards you can use a custom url rewriter which gives you control of the url mappings. Such as handling situations where the mapping is not identical 1:1 mapping. See more details at the |
