MysticUnicorn
MysticUnicorn

Reputation: 128

HaProxy unescaping path params

I have a RestEasy path:

    @GET
    @Path("loadPageData/{path}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response loadPageData(@PathParam("path") String path) {
//TODO ETC

which works well on my local environment. I can call the api with HTTP Response 200 which is the expected result, like this:

GET loadPageData/%2Fuser%2Foptions

but I have a HaProxy set up on my prod environment with this rule:

http-request set-uri %[url,regsub(^/api/,/,)]

and as I looking through my access logs this will unescapes my path param like this:

GET loadPageData/user/options

which gives me HTTP error 500 when I call from Angular with proxy set to prod frontend path:

javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost/rest/api/admin/loadPageData/user/options
    at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:173) ~[resteasy-jaxrs-3.15.1.Final.jar!/:3.15.1.Final]
    at org.jboss.resteasy.core.registry.RootNode.match(RootNode.java:43) ~[resteasy-jaxrs-3.15.1.Final.jar!/:3.15.1.Final]

My querstion is how can I remove the "/api/" path from the uri without unescaping my path params, like "/" (slash) or " " (space)? What http-request should I use?

Edit: query params works fine like

GET loadPageData/?path=%2Fuser%2Foptions

but I'm not allowed to modify this source code.

Upvotes: 1

Views: 34

Answers (0)

Related Questions