This example illustrates how to use Spring Boot with Camel. It implements a reverse proxy using platform-http.
The project uses camel-platform-http-starter component as the implementation for platform-http-engine and camel-http-starter to implement the producer calling the http endpoint.
You can run this example using:
mvn spring-boot:runAfter the Spring Boot application is started, you can execute the following HTTP requests:
curl --proxy http://localhost:8080 -L http://httpbin.org/get?arg1=val1 -H 'accept: application/json'The command will call a test endpoint using the application as reverse proxy, you should see the Camel headers from both request and response in the log. Something similar to:
INFO 70370 --- [ad #1 - WireTap] header-request : {accept=application/json, arg1=val1, CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=GET, CamelHttpPath=/get, CamelHttpQuery=arg1=val1, CamelHttpServletRequest=org.apache.catalina.connector.RequestFacade@4f31b074, CamelHttpServletResponse=org.springframework.web.context.request.async.StandardServletAsyncWebRequest$LifecycleHttpServletResponse@158137c0, CamelHttpUri=/get, CamelHttpUrl=http://httpbin.org/get, CamelPlatformHttpContextPath=/, host=httpbin.org, proxy-connection=Keep-Alive, user-agent=curl/8.9.1}
INFO 70370 --- [ad #2 - WireTap] header-response : {accept=application/json, Access-Control-Allow-Credentials=true, Access-Control-Allow-Origin=*, arg1=val1, CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=GET, CamelHttpQuery=arg1=val1, CamelHttpResponseCode=200, CamelHttpResponseText=OK, CamelHttpServletRequest=org.apache.catalina.connector.RequestFacade@4f31b074, CamelHttpServletResponse=org.springframework.web.context.request.async.StandardServletAsyncWebRequest$LifecycleHttpServletResponse@158137c0, CamelHttpUri=/get, CamelHttpUrl=http://httpbin.org/get, CamelPlatformHttpContextPath=/, Connection=keep-alive, Content-Length=387, Content-Type=application/json, Date=Thu, 04 Sep 2025 11:59:30 GMT, proxy-connection=Keep-Alive, Server=gunicorn/19.9.0}
The Spring Boot application can be stopped pressing [CTRL] + [C] in the shell.
Make sure you can access to a namespace on an OpenShift cluster, then run
mvn install -P openshiftIn OpenShift, an Ingress resource is used instead of a Route when the application requires the original Host header to be preserved. This is because OpenShift Routes rely on header-based routing, which can modify the Host header, making them unsuitable for scenarios where the backend depends on the original value. To support this behavior, a specific Ingress is configured to forward requests to the appropriate backend based on the requested host. If additional backend endpoints need to be exposed through the proxy, corresponding Ingress rules must be defined accordingly; it is also possible to set host using wildcards.
Once the POD is ready you can call the application using the exposed ingress at
curl --proxy http://$(oc get ingress camel-example-spring-boot-platform-http-proxy -o go-template --template='{{(index .status.loadBalancer.ingress 0).hostname}}'):80 -L http://httpbin.org/get?arg1=val1 -H 'accept: application/json'you can see the log at
oc logs deployment/camel-example-spring-boot-platform-http-proxyIf you hit any problem using Camel or have some feedback, then please let us know.
We also love contributors, so get involved :-)
The Camel riders!