I'm currently developing a REST Application with Apache Camel (using camel-spring), and getting some confusing behaviour. I have a set of endpoints defined in REST DSL, some are simply proxy requests to another server, and some others are passed on to routes I've defined for data aggregation. The DSL looks as follows:
<rest>
<!-- Specific DSL requests -->
<get uri="/v1/aggregate/data" consumes="application/json" produces="application/json">
<to uri="direct:dataEnrichment" />
</get>
<get uri="/v1/customer/{custId}/devices" consumes="application/json" produces="application/json">
<to uri="direct:getCustomerDevices" />
</get>
<get uri="/v1/login/{custId}" consumes="application/json" produces="application/json">
<to uri="direct:getCustomer" />
</get>
<get uri="/v1/status" consumes="application/json" produces="application/json">
<to uri="direct:statusInfo" />
</get>
<!-- Proxy requests -->
<post uri="/v1?matchOnUriPrefix=true&chunked=false">
<to uri="direct:proxyOut" />
</post>
<get uri="/v1?matchOnUriPrefix=true&chunked=false">
<to uri="direct:proxyOut" />
</get>
<put uri="/v1?matchOnUriPrefix=true&chunked=false">
<to uri="direct:proxyOut" />
</put>
<delete uri="/v1?matchOnUriPrefix=true&chunked=false">
<to uri="direct:proxyOut" />
</delete>
</rest>
The idea is that any requests with no exact matching URI get proxied through to another system (which is not Apache Camel). This saves me having to write a definition for every REST API on the other system (there are a lot).
All was working well, until I added the two requests with {custId} in the URI. Those requests work fine, but every time I try a URI that should get proxied through, I get 405 Method Not Allowed.
EDIT: I should also have mentioned that I'm using Jetty as the REST component. Camel is running stand-alone, using org.apache.camel.spring.Main to start it up. I'm calling it with Postman at this stage, and the 405 response appears to be coming from Jetty/Camel.
The REST configuration looks like this (The security handler is using the Jetty BasicAuthenticator):
<restConfiguration contextPath="/mobilegateway/api" scheme="http"
host="0.0.0.0" bindingMode="off"
enableCORS="true"
component="jetty" port="8079">
<endpointProperty key="handlers" value="securityHandler" />
<endpointProperty key="sessionSupport" value="true" />
<endpointProperty key="httpClient.idleTimeout" value="30000" />
</restConfiguration>
The Proxy requests all send to the direct:proxyOut route, which looks like this:
<route id="proxyOutbound">
<description>A simple outbound route to proxy REST requests.</description>
<from uri="direct:proxyOut" />
<removeHeaders pattern="Authorization" />
<to
uri="http://{{remoteAddress}}/data/json?bridgeEndpoint=true&throwExceptionOnFailure=false" />
</route>
The intention is that everything after the /v1 in the URI is passed over in the proxied request. I've checked using Wireshark, and the request is not getting proxied. If I remove the routes with {custId} in the path, everything works fine.
Am I doing something wrong or is this a bug in camel/camel-spring?