<p>This example is specifically about Nextcloud, although I had the same (unsolved issue) in the past with others.</p>
<p>What I simply want to do, is to access nextcloud under <code>www.myserver.com/nextcloud</code>.</p>
<p>I am able to kind of accessing Nextcloud front page with my present setup, but everything that's not directly under the basepath, is broken. Images and JS for instance.</p>
<p>Sure enough, I can manually enter in my browser web address something like <code>www.myserver.com/nextcloud/core/css/guest.css</code>, and it's there. But the issue is that the front page from Nextcloud, tries to access everything under: <code>www.myserver.com/core/css/guest.css</code></p>
<p>Here is my ingress:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nextcloud
  namespace: homeserver
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: letsencrypt-staging
    nginx.ingress.kubernetes.io/configuration-snippet: |
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $http_connection;
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - host: www.myserver.com
    http:
      paths:
      - path: /nextcloud(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: nextcloud
            port:
              number: 80
</code></pre>

jbssm
<p>You should have to use the relative path in backend or HTML if you are using that.</p>
<p>However you can do one thing</p>
<p>if your all request getting by the application at : <code>www.myserver.com/core</code> and there is no other folder exist or endpoint</p>
<p>you can create some redirection rules like :</p>
<pre><code>www.myserver.com/core -&gt; www.myserver.com/nextcloud/
</code></pre>
<p>once redirect redirected to new URL further another ingress that you have created will take care of the path and serve.</p>
<p>Ingrss example</p>
<pre><code>metadata:
  name: ingress-test
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/enable-rewrite-log: &quot;true&quot;
    nginx.ingress.kubernetes.io/location-snippet: |
      location = /core/ {
        proxy_pass http://[hostname]/nextcloud/;
        }
spec:
</code></pre>
<p>still, it depends on your application config and structure.</p>
