<p>I'm trying to add an spring boot admin interface to some microservice that are deployed in kubernetes cluster. the spring boot admin app has the following configuration:</p>

<pre><code>spring:
        application:
          name: administrator-interface
        boot:
          admin:
            context-path: "/ui"
      server:
        use-forward-headers: true
</code></pre>

<p>The kubernetes cluster has an ingress that works as an api gateway:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
    {{- range $key, $value := .Values.ingress.annotations }}
    {{ $key }}: {{ $value | quote }}
    {{- end }}
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    {{- range $host := .Values.ingress.hosts }}
    - host: {{ $host }}
      http:
        paths:
          - path: /admin/(.+)
            backend:
              serviceName: administrator-interface-back
              servicePort: 8080
    {{- end -}}
  {{- if .Values.ingress.tls }}
  tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
  {{- end -}}
{{- end -}}
</code></pre>

<p>when I try to see the spring boot admin ui I had the following error:</p>

<p>URL in explorer: <a href="https://XXXXXX(thisisgivenBYDNS)/admin/ui" rel="nofollow noreferrer">https://XXXXXX(thisisgivenBYDNS)/admin/ui</a></p>

<pre><code>GET https://XXXXXX/ui/assets/css/chunk-common.6aba055e.css net::ERR_ABORTED 404
</code></pre>

<p>The URL is wrong because it should be <a href="https://XXXXXX/admin/ui/assets/css/chunk-common.6aba055e.css" rel="nofollow noreferrer">https://XXXXXX/admin/ui/assets/css/chunk-common.6aba055e.css</a></p>

<p>It is not adding the /admin path that is given by the ingess</p>

<p>How can i solve this and configure an aditional path to serve the static content in the request from the right URL?</p>

<p>Thanks in advance</p>

Gabriel García Garrido
<p>The problem is that your spring boot admin interface has no way to know that you're using "/admin" suburl.</p>

<p><code>nginx.ingress.kubernetes.io/rewrite-target: /$1</code> ask nginx to rewrite your url matching the second group.
So when you're hitting: <code>https://XXXXX/admin/ui</code> nginx rewrite your url to <code>https://XXXXXX/ui</code> and then send it to spring boot.</p>

<p>I don't know well spring boot  but you should have a way to provide him a suburl so instead of serving to <code>/ui</code> it server to <code>/$BASE_URL/ui</code>.</p>

<p>Then weather how it works you might need to change how nginx rewrite the url by something like:</p>

<ul>
<li><code>path: ^(/admin/)(.+)\</code></li>
<li><code>nginx.ingress.kubernetes.io/rewrite-target: $1/$2</code></li>
</ul>
