title: Expose app with Kubernetes NGINX Ingress Controller on subpath with no control over the basepath of the app
body: <p>I still can't wrap my head around the problem myself, so I'm not even sure if this is even possible. I cannot change my domain so I can only deploy my apps on subpaths via Ingress and not on subdomains, and I was able to deploy multiple apps by using a combination of <code>nginx.ingress.kubernetes.io/rewrite-target: /</code> and <code>nginx.ingress.kubernetes.io/configuration-snippet: rewrite /&lt;basepath&gt;/(.*) /$1;</code> for basepaths when I am able to control the basepath of the app, which is the case for e.g. the pgAdmin4 Docker-container (provides an ENV var), or apps I wrote myself.</p>
  
  <p>Some applications however, like the Kubernetes Dashboard, k8dash or Kibana, do not provide a convenient option to specify the basepath in the <code>k8s-Deployment</code> object, and I couldn't get them to work.</p>
  
  <p>The main problem seem to be paths like <code>/assets/</code>, <code>/js/</code>, <code>/css/</code> etc.</p>
  
  <p>I tried different versions with the rewrite path but I do not think this rewrites the content of my HTML, especially not if it is dynamically generated by js-frameworks like Angular.</p>
  
  <p>Is there a sure-fire way to expose e.g. the Kubernetes-Dashboard or Kibana on a subpath, so that the deferred calls on the site are not resulting in 404?</p>
  
  <p>PS: sorry if I couldn't articulate my problem in a way that makes it easy to answer the question, so if some inconsistencies or unknowns for anyone still exist, I would like to incorporate that into this question immediately. Thank you very much in advance.</p>
  
  <p>PPS: I already tried like a 100 google search results and stackoverflow solutions I found, but still couldn't manage, so either my search skills are very poor, there is no solution for this or it is very hard to implement. One such though addresses a similar <a href="https://serverfault.com/questions/932628/how-to-handle-relative-urls-correctly-with-a-nginx-reverse-proxy">issue</a> related to nginx itself but it did not help either</p>