Croway opened a new pull request, #1940: URL: https://github.com/apache/camel-spring-boot/pull/1940
## Problem `platform-http` is the one Camel HTTP consumer that does not make `Exchange.HTTP_PATH` (`CamelHttpPath`) relative to the consumer's own registered path - `camel-servlet`, `camel-jetty`, `camel-netty-http` and `camel-undertow` all already do. [apache/camel#26114](https://github.com/apache/camel/pull/26114) (CAMEL-24625) added a new consumer option `stripUriPrefix` (boolean, default `false`) on `PlatformHttpEndpoint` plus the shared helper `org.apache.camel.http.base.HttpHelper.stripUriPrefix(...)`, and wired it into the Vert.x platform-http engine. On the **Spring Boot (servlet) platform-http engine** in this repo the option was a no-op: nothing stripped the registered consumer path from `CamelHttpPath`. This PR wires it up, so the same zero-header-manipulation path-based reverse proxy works on `camel-platform-http-starter` too: ```java from("platform-http:/reverse-proxy?matchOnUriPrefix=true&stripUriPrefix=true") .to("http://backend?bridgeEndpoint=true") // /reverse-proxy/get -> http://backend/get ``` ## Change - `SpringBootPlatformHttpConsumer.handleService` now rewrites `CamelHttpPath` via `HttpHelper.stripUriPrefix(httpPath, getEndpoint().getPath())` when `stripUriPrefix=true` is set on the endpoint, mirroring the Vert.x engine's `VertxPlatformHttpConsumer`. Only `CamelHttpPath` is touched; `CamelHttpUri`/`CamelHttpUrl` keep the full original path. - New tests: - `SpringBootPlatformHttpStripUriPrefixTest` - end-to-end reverse proxy using a second `platform-http` route on the same embedded server as the backend (the module's WireMock-based bridged-endpoint tests are `@Disabled` under Spring Boot 4 / Jetty 12): verifies the prefix is stripped before bridging, that without the option the full path is forwarded unchanged, and that an exact match strips down to `/`. - `SpringBootPlatformHttpStripUriPrefixContextPathTest` - the option still works when a non-default `server.servlet.context-path` is configured (the servlet context path is already removed before Camel sees the request; only the consumer path is stripped). - Default is unchanged (`false`), so existing behaviour is untouched. ## Verification - `mvn test` on `components-starter/camel-platform-http-starter`: **138 tests run, 0 failures/errors** (2 pre-existing `@Disabled`), including the 4 new tests. JIRA: [CAMEL-24625](https://issues.apache.org/jira/browse/CAMEL-24625) Claude Code on behalf of Croway -- 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]
