Croway opened a new pull request, #207:
URL: https://github.com/apache/camel-spring-boot-examples/pull/207
## Summary
The `platform-http-proxy` example was broken in three ways:
- The README's `curl --proxy` command never reached the route: servlet
containers normalize an absolute-form request line down to just the path,
discarding the target host, so the request never matched
`platform-http:proxy/*`.
- `toD("${headers.CamelHttpUrl}")` used the *incoming* request's own URL
(`CamelHttpUrl` is set from `request.getRequestURL()`, i.e. this application's
own address), causing the route to call itself in an infinite loop until the
HTTP connection pool exhausted (503s).
- The consumer path literal `proxy` collides with a reserved marker in
`camel-platform-http` that turns the endpoint into a catch-all consumer for a
`Host`-header-based forward proxy - a mode only implemented by the Vert.x
platform-http engine, not by `camel-platform-http-starter` (the servlet/Spring
MVC engine this example uses). Left as-is it silently degrades into an
unguarded catch-all matching unrelated paths instead of 404ing.
Redesigned as a real path-based reverse proxy: requests under
`/reverse-proxy/**` are forwarded to a configurable backend
(`reverse-proxy.target-base-uri`) using `camel-http`'s `bridgeEndpoint` mode,
which appends `CamelHttpPath`/`CamelHttpQuery` onto the fixed target
automatically instead of trusting a self-referential header.
## Test plan
- [x] `mvn compile` on the module
- [x] Ran the app locally and hit it with curl against real `httpbin.org`:
- `GET /reverse-proxy/get?arg1=val1` forwards to `httpbin.org/get`, query
string preserved
- `GET /reverse-proxy` and `/reverse-proxy/` forward correctly to the
backend root
- Unrelated paths (`/nope`, `/xyz`, `/reverse-proxyfoo`, `/other/path`)
correctly return 404 instead of being swallowed by the route (this used to
silently catch-all under the old `proxy` literal path)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Tgb2b9DSh1ncG7C82rwzsE
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]