Webapps each under own subdirectory // Forwarding to index.html

Greetings, I want to hook various web applications into paths, for example /app1, /app2 etc. using Kong inside Kubernetes with kong Ingress Controller.

Currently, I do this using Ingress and KongIngress, like so (testing using the socks-shop Kubernetes demo application).

apiVersion: extensions/v1beta1
kind: Ingress
  name: demo-ingress
  namespace: sock-shop
    configuration.konghq.com: pathstripper
  - host: www.my.com
      - path: /socks
          serviceName: front-end
          servicePort: 80
apiVersion: configuration.konghq.com/v1
king: KongIngress
  name: pathstripper
  namespace: sock-shop
  path: /
  preserve_host: true
  strip_path: true

So far so good, but two issues come up:

  1. Visiting /socks leads to it loading the / of the web application, but it cannot find files under its root (like /js, /cart or /catalogue) because the web browser is still using the basepath www.my.com/ instead of www.my.com/socks/.

How to fix this?

As a hack, I added routes for /cart, /catalogue (because the JS application believes it has the webroot for itself) but obviously this does not scale…

  1. Visiting /socks/index.html with the above-mentioned hack works and all the paths are fine, but visiting /socks does not work (does not find its static resources under /js etc. which are reachable under /socks/js/bla.js).

How to add a redirect from /socks to /socks/index.html ?

As a hack, using the Kong-API directly, I added a second service homed under /index.html and a route at /socks with regex_priority 1 (so that it matches only on direct match on /socks/ not on /socks/js/jquery.js for example). But I cannot seem to transform this solution from curl Kong-API calls to KongIngress and Ingress objects in Kubernetes - it just won’t create a second Kong Service (why? maybe because it creates just 1 service per backend pod/container - but dont know exactly - any way to make it create a 2nd Kong Service?).

How to solve this overall issue properly?

These two issues seem related. Totally stumped - need help please!