not able to load static content in ingress resource

12/13/2019

I am facing a wierd issue... I am trying to invoke active mq webui using ingress resources... page is loading but static content is not loading and it is saying not found....

Here is my ingress resource.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
     - http:
        paths:
          - path: /(.*)\.(jpg|jpeg|png|gif|ico|js|css|csv|json)$
            backend:
              serviceName: nginx-static
              servicePort: 80
          - path: "/"
            backend:
              serviceName: service1
              servicePort: 8233
          - path: "/test"
            backend:
              serviceName: server2
              servicePort: 9002
      http:
        paths:
          - path: "/admin"
            backend:
              serviceName: activemq-server
              servicePort: 80

Kindly help how static content will be loaded....
-- magic
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

12/13/2019

Add to your ingress configuration file following annotations:

nginx.ingress.kubernetes.io/add-base-url: "true" 
nginx.ingress.kubernetes.io/rewrite-target: "specify rewriting rule here"

Similar problem you can find here: ingress-static-contetnt.

-- MaggieO
Source: StackOverflow