Kubernetes Nginx ingress.kubernetes.io/rewrite-target issues due paths in app

3/9/2018

I am using nginx with kube-lego but this does not really matter.

I configured the ingress to listen on /app1 and rewrite the target to /.

So far as I understand the problem is that the apps UI request the css files from /assets/example.css instead of /app_1/assets/example.css and so the UI looks awful.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: app1
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "GET"
    nginx.ingress.kubernetes.io/cors-allow-origin: "*"
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: "api-dev.test.com"
    http:
      paths:
      - path: /app1
        backend:
          serviceName: app1
          servicePort: 8080
  tls:
    - secretName: api-dev-tls
      hosts:
      - "api-dev.test.com"

Anyone had same issues, hint or solution to this? The app is not under control by me. Hope there is any chance to solve this.

-- Tim Schwalbe
kubernetes
kubernetes-ingress

0 Answers