Help identifying source of malformed target

Hi all,

I’ve been adapting Shinyproxy/Containerproxy to run on an istio-enabled kubernetes cluster. I can launch & delete the app containers using the Shinyproxy UI with mTLS enabled, and can receive a correct html reponse with curl from the shinyproxy container, but I’ve hit a wall - 400 bad request when trying to access the app via /app or /app_direct.

With very little Java experience I’m looking for help tracing the source of the error below. The incorrectly formatted target is in bold in the debug log snippet below (taken during initial launch of the app via the shinyproxy ui). It should read:

sp-service-3057736c-68b8-49e6-994b-02386c6b8eed.mynamespace.svc.cluster.local:3838

but instead reads:

sp-service-3057736c-68b8-49e6-994b-02386c6b8eed.mynamespace.svc.cluster.local/11.65.233.111:3838

The key-value proxy mappings appear to be correct, so the unwanted “/” & internal IP (faked here) is being added somewhere else during attempted access.

I’d really value some suggestions of where to look. I’ve spent a lot of time chasing this down, and seem to be going round in circles. My plan is obviously to submit a pull request to containerproxy once I’ve cracked this to allow it to be used on an istio-enabled setup.

Many thanks,

Stuart

2019-11-10 17:47:56.386 DEBUG 1 — [ XNIO-2 task-1] o.s.c.e.PropertySourcesPropertyResolver : Found key ‘proxy.admin-groups’ in PropertySource ‘configurationProperties’ with value of type String
2019-11-10 17:47:56.387 DEBUG 1 — [ XNIO-2 task-1] o.s.c.e.PropertySourcesPropertyResolver : Could not find key ‘proxy.admin-groups[0]’ in any property source
2019-11-10 17:47:56.395 DEBUG 1 — [ XNIO-2 task-1] io.undertow.request : Matched prefix path /proxy_endpoint/85194935-1137-426e-b7f3-81cdc954f445 for path /proxy_endpoint/85194935-1137-426e-b7f3-81cdc954f445/
2019-11-10 17:47:56.395 DEBUG 1 — [ XNIO-2 task-1] io.undertow.request : Matched prefix path /proxy_endpoint/85194935-1137-426e-b7f3-81cdc954f445 for path /proxy_endpoint/85194935-1137-426e-b7f3-81cdc954f445/
2019-11-10 17:47:56.397 DEBUG 1 — [ XNIO-2 task-1] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name ‘dispatcherServlet’: assuming HandlerAdapter completed request handling
2019-11-10 17:47:56.397 DEBUG 1 — [ XNIO-2 task-1] o.s.web.servlet.DispatcherServlet : Successfully completed request
2019-11-10 17:47:56.397 DEBUG 1 — [ XNIO-2 task-1] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally
2019-11-10 17:47:56.398 DEBUG 1 — [ XNIO-2 task-1] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed
2019-11-10 17:47:56.398 DEBUG 1 — [ XNIO-2 task-1] o.s.b.w.s.f.OrderedRequestContextFilter : Cleared thread-bound request context: HttpServletRequestImpl [ GET /proxy_endpoint/85194935-1137-426e-b7f3-81cdc954f445/ ]
2019-11-10 17:47:56.426 DEBUG 1 — [ XNIO-2 I/O-1] io.undertow.server.handlers.proxy : Sending request ClientRequest{path=’/’, method=GET, protocol=HTTP/1.1} to target sp-service-3057736c-68b8-49e6-994b-02386c6b8eed.mynamespace.svc.cluster.local/11.65.233.111:3838 for exchange HttpServerExchange{ GET /proxy_endpoint/85194935-1137-426e-b7f3-81cdc954f445/ etc

Ok, so my gut tells me this traces to the run method of undertow proxyaction. I’ll investigate further, but if anyone knows a reason I’m wasting my time please tell me! Especially if I misread the debug output.

Cheers,
Stuart

Ok, it took WAY too long but this is finally sorted. I’m also completely fed up of Java.

In the end it was my mistake, like so many other things. The odd format for the target is fine in istio, as is a simple pod IP, so long as there’s a decent service available before shinyproxy tries to connect. I still don’t understand the /, but I don’t understand Java.

I now have my own tweak of SP running fine on an mTLS-enabled Istio cluster. More testing needed, but I’ll submit the minimal necessary changes as a pull request to containerproxy in the next few days. Hopefully my few weeks of hell can help someone else!

Beer.