2

I have an ingress defined as follows;

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: webserver-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/configuration-snippet: |
     rewrite ^(/master)$ $1/ redirect;
spec:
  rules:
  - host: my.test.domain
    http:
      paths:
      - path: /master
        backend:
          serviceName: airflow-webserver-svc
          servicePort: 80

The service airflow-webserver-svc is pointing towards airflow webserver. the ingress now hits airflow webserver on GET /, but the site gets redirected from my.test.domain/master to my.test.domain/home which is the landing page of airflow webserver, but nginx returns 404 Page not found on that link :(. All works fine if I change the ingress path: /, going to my.test.domain open up airflow webserver /home page, which then gets redirected to /login page. But I need to open the same webpage from my.test.domain/master. How can I do that ?

It doesn't redirect from path: "/master" to "/" inside the service. Is there any way to redirect from specified path in the ingress file to the root path of the service?

UPDATE:

Found out that airflow has its special configuration to do, when running behind proxy (here). I applied this solution but still no luck.

Anum Sheraz
  • 2,383
  • 1
  • 29
  • 54

1 Answers1

1

Made it work by keeping ingress same as mentioned above, and adding this in airflow config under webserver section;

[webserver]
  enable_proxy_fix = True
  base_url = http://my.test.domain/master/

and restart the webserver.

Anum Sheraz
  • 2,383
  • 1
  • 29
  • 54