How to set Proxypass and Proxypassrereverse in K8S like Apache

158 views Asked by At

I encounter an issue about how to set Proxypass and Proxypassrereverse in K8S like Apache.

1.In Apache application There is a way to configure Proxypass and Proxypassrereverse (see the picture) enter image description here

2.I had a AKS environment which deployed ingress-nginx-controller for each app. My purpose is when client access to https://example.a.com/test, the ingress will do proxypass to https://example.b.com/test (but not redirect)

But I'm not sure if there is a solution to set it in ingress yaml file.

Could you please help with this issue? Thanks in advance

Is there any solution about Proxypass and Proxypassrereverse settings in ingress-nginx-controller like Apache?

1

There are 1 answers

0
Suresh Chikkam On

Is there any solution about Proxypass and Proxypassrereverse settings in ingress-nginx-controller like Apache?

  • Using the ingress-nginx controller, you can define path-based routing rules to forward traffic from one service to another.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    nginx.ingress.kubernetes.io/proxy-pass: "http://backend-service:8080"
    nginx.ingress.kubernetes.io/proxy-pass-reverse: "http://backend-service:8080"
spec:
  rules:
    - host: kuberdec11.com
      http:
        paths:
          - path: /backend
            pathType: Prefix
            backend:
              service:
                name: backend-service
                port:
                  number: 80
  • nginx.ingress.kubernetes.io/proxy-pass Specifies the backend URL to which traffic should be forwarded, /proxy-pass-reverse Specifies the same backend URL for reverse proxy functionality.

enter image description here

enter image description here