Skip to content

CAMEL-24625: camel-platform-http: add stripUriPrefix option for path-based reverse proxies - #26114

Draft
Croway wants to merge 4 commits into
apache:mainfrom
Croway:platform-http-strip-uri-prefix
Draft

CAMEL-24625: camel-platform-http: add stripUriPrefix option for path-based reverse proxies#26114
Croway wants to merge 4 commits into
apache:mainfrom
Croway:platform-http-strip-uri-prefix

Conversation

@Croway

@Croway Croway commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

platform-http is the one HTTP consumer that does not make CamelHttpPath relative to its own registered path - camel-servlet, camel-jetty, camel-netty-http and camel-undertow all strip their registered consumer path already. This means combining platform-http with the camel-http producer's bridgeEndpoint=true to build a zero-code, path-based reverse proxy doesn't work: the full raw request path is forwarded instead of the path relative to the consumer, forcing route authors to manually strip the prefix with setHeader + a Simple/OGNL substring() expression.

Change

Adds a new consumer option stripUriPrefix (default false) on platform-http:

from("platform-http:/reverse-proxy?matchOnUriPrefix=true&stripUriPrefix=true")
    .to("http://backend?bridgeEndpoint=true")   // /reverse-proxy/get -> http://backend/get
  • New shared, defensive pure function HttpHelper.stripUriPrefix(requestPath, consumerPath) in camel-http-base, usable by other HTTP consumers in the future.
  • New stripUriPrefix consumer option on PlatformHttpEndpoint (engine-agnostic).
  • Wired up in the Vert.x engine (camel-platform-http-vertx); the Spring Boot engine is not wired in this PR - it lives in the separate apache/camel-spring-boot repo and gets its own follow-up PR (already in progress) once this PR provides the option to build against.
  • CamelHttpUri/CamelHttpUrl are left untouched - only CamelHttpPath is rewritten.
  • Default is unchanged (false), and the existing platform-http:proxy forward-proxy mode (CAMEL-24455) is provably unaffected: its consumer path is "/", and the helper treats a consumer path of "/" as "nothing to strip".
  • Docs added to platform-http-component.adoc.

JIRA: CAMEL-24625

Opening as a draft pending review from the author (a Camel committer) before it's marked ready for review.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tgb2b9DSh1ncG7C82rwzsE

Croway and others added 3 commits September 4, 2026 10:45
…-based reverse proxies

platform-http is the only HTTP consumer (unlike camel-servlet, camel-jetty,
camel-netty-http and camel-undertow) that does not make CamelHttpPath
relative to the consumer's own registered path, so combining it with the
http producer's bridgeEndpoint option to build a path-based reverse proxy
forwards the full raw request path instead of the path relative to the
consumer.

Add a new consumer option, stripUriPrefix (default false), and a shared
HttpHelper.stripUriPrefix(requestPath, consumerPath) helper in
camel-http-base that other HTTP consumers could reuse. The helper is a
defensive pure function: it only strips a full, boundary-respecting match
of the consumer path (REST-DSL {name} placeholders included) and otherwise
returns the request path unchanged - in particular a consumer path of "/"
(the platform-http:proxy pseudo-path) is always a no-op, so the existing
platform-http:proxy forward-proxy mode is unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgb2b9DSh1ncG7C82rwzsE
Apply HttpHelper.stripUriPrefix to CamelHttpPath in
VertxPlatformHttpConsumer.populateCamelMessage when the new consumer
option is enabled, using the endpoint's own registered path as the
consumer path. This is the single place headers are (re)populated for
a request that reaches the route - the OAuth security handler path
resets the message and lets processHttpRequest/populateCamelMessage
repopulate headers afterwards, so no separate handling is needed there.
CamelHttpUri/CamelHttpUrl are untouched, only CamelHttpPath is rewritten.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgb2b9DSh1ncG7C82rwzsE
… reverse proxy

Add a short section next to the existing reverse-proxy documentation
showing the stripUriPrefix + bridgeEndpoint combination, with a
before/after CamelHttpPath example and a cross-reference clarifying
this is distinct from the platform-http:proxy Host-header forward
proxy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgb2b9DSh1ncG7C82rwzsE
@Croway
Croway marked this pull request as ready for review September 4, 2026 08:48
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@Croway
Croway force-pushed the platform-http-strip-uri-prefix branch from 431386b to 4c22753 Compare September 4, 2026 08:49
@Croway Croway changed the title camel-platform-http: add stripUriPrefix option for path-based reverse proxies CAMEL-24625: camel-platform-http: add stripUriPrefix option for path-based reverse proxies Sep 4, 2026
@Croway
Croway marked this pull request as draft September 4, 2026 08:51
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

✅ Generated files have been updated

A regen commit was automatically pushed to this branch. CI will re-run shortly.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-http-base
  • components/camel-platform-http-vertx
  • components/camel-platform-http
  • dsl/camel-endpointdsl

ℹ️ Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the test-dependents label to force testing all dependents.


🔬 Scalpel shadow comparison — Scalpel: 80 tested, 25 compile-only — current: 78 all tested

Maveniverse Scalpel detected 105 affected modules (current approach: 78).

⚠️ Modules only in Scalpel (27)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 80 modules (5 direct + 75 downstream), skip tests for 25 (generated code, meta-modules)

Modules Scalpel would test (80)
  • camel-a2a
  • camel-ai-observability
  • camel-as2
  • camel-atmosphere-websocket
  • camel-catalog
  • camel-clickup
  • camel-consul
  • camel-cxf-common
  • camel-cxf-rest
  • camel-cxf-soap
  • camel-cxf-spring-common
  • camel-cxf-spring-rest
  • camel-cxf-spring-soap
  • camel-cxf-spring-transport
  • camel-cxf-transport
  • camel-endpointdsl
  • camel-graphql
  • camel-http
  • camel-http-base
  • camel-http-common
  • camel-java-joor-dsl
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-jetty
  • camel-jetty-common
  • camel-jsonpath
  • camel-kamelet
  • camel-knative-http
  • camel-kubernetes
  • camel-langchain4j-agent
  • camel-langchain4j-chat
  • camel-langchain4j-embeddings
  • camel-langchain4j-embeddingstore
  • camel-launcher-container
  • camel-lra
  • camel-mcp-server
  • camel-micrometer-observability
  • camel-micrometer-prometheus
  • camel-netty-http
  • camel-oauth
  • camel-observability-services
  • camel-openai
  • camel-openapi-validator
  • camel-opentelemetry
  • camel-opentelemetry2
  • camel-platform-http
  • camel-platform-http-jolokia
  • camel-platform-http-main
  • camel-platform-http-vertx
  • camel-quickfix
  • camel-rest-openapi
  • camel-rest-postman
  • camel-restdsl-openapi-plugin
  • camel-sap-netweaver
  • camel-servlet
  • camel-slack
  • camel-soap
  • camel-spring-ai-chat
  • camel-spring-rabbitmq
  • camel-state-store
  • camel-telegram
  • camel-telemetry
  • camel-telemetry-dev
  • camel-test-main-junit5
  • camel-test-main-junit6
  • camel-undertow
  • camel-undertow-spring-security
  • camel-vertx-http
  • camel-webhook
  • camel-whatsapp
  • camel-xml-io-dsl
  • camel-xml-jaxb-dsl
  • camel-xml-jaxb-dsl-test-definition
  • camel-xml-jaxb-dsl-test-spring
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
  • camel-zookeeper
Modules with tests skipped (25)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

Build reactor — dependencies compiled but only changed modules were tested (5 modules)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Endpoint DSL
  • Camel :: HTTP :: Base
  • Camel :: Platform HTTP
  • Camel :: Platform HTTP :: Vert.x

⚙️ View full build and test results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant