You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Federico Mariani (Jira)" <ji...@apache.org> on 2026/09/04 08:28:00 UTC

[jira] [Created] (CAMEL-24625) camel-platform-http: CamelHttpPath should optionally be relative to the consumer path (stripUriPrefix)

Federico Mariani created CAMEL-24625:
----------------------------------------

             Summary: camel-platform-http: CamelHttpPath should optionally be relative to the consumer path (stripUriPrefix)
                 Key: CAMEL-24625
                 URL: https://issues.apache.org/jira/browse/CAMEL-24625
             Project: Camel
          Issue Type: Improvement
          Components: camel-platform-http
            Reporter: Federico Mariani
            Assignee: Federico Mariani


*Use case:* building a path-based reverse proxy on platform-http — expose a backend under a prefix (e.g. {{/reverse-proxy/**}}) and forward to it ({{http://backend/**}}), stripping the prefix. This is the standard reverse-proxy shape (nginx {{location}}, Spring Cloud Gateway {{StripPrefix}}, Traefik {{StripPrefix}}, Envoy {{prefix_rewrite}}) and today requires manual header surgery:

{code:java}
from("platform-http:/reverse-proxy?matchOnUriPrefix=true")
    .setHeader(Exchange.HTTP_PATH, simple("${header.CamelHttpPath.substring(14)}"))  // 14 == prefix length, duplicated by hand
    .to("http://backend?bridgeEndpoint=true")
{code}

camel-servlet, camel-jetty, camel-netty-http and camel-undertow don't need this — their consumers already make CamelHttpPath relative to the registered consumer path, so bridgeEndpoint=true alone does the right thing. platform-http (both the Vert.x and Spring Boot/camel-platform-http-starter engines) is the one HTTP consumer that always reports the full raw path.

*Proposal:* add a {{stripUriPrefix}} consumer option (default {{false}}) to PlatformHttpEndpoint. When set, the matched consumer path is removed from CamelHttpPath (segment-boundary aware), so the reverse proxy above becomes:

{code:java}
from("platform-http:/reverse-proxy?matchOnUriPrefix=true&stripUriPrefix=true")
    .to("http://backend?bridgeEndpoint=true")
{code}

CamelHttpUri/CamelHttpUrl keep the full path. Default is {{false}} to avoid a breaking change (existing Vert.x routes rely on the full path); aligning the default with the other consumers is left to a future major version.

Draft PR with a reference implementation: (to be linked).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)