0

I assume more than two domains to be used for my multi-tenant code, domain1.com, mydomain2.com each will have a unique identifier and an ID would be maintained for each

I want my common app myApp hosted at myappdomain.com to serve both domains using CNAME and the service container should get a request prefix in the path based on the domain like:

domain1.com/home should translate the myApp request like myApp/111/home where 111 is the id

domain2.com/home should translate the myApp request like myApp/222/home where 222 is the id

This is working when the request is formed like domain1.com/myApp/111/home with the config below, but I want to use a generic rewrite rule to mask domain1.com/home to myApp/111/home & domain2.com/home to myApp/222/home

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: myapp-custom-ingress
  namespace: myapp-dev
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /myapp/$1
spec:
  rules:
    - host: myappdomain.com
      http:
        paths:
          - path: /myapp/(.*)
            pathType: ImplementationSpecific
            backend:
              serviceName: ui-myapp-proxy-mgmt-webapp
              servicePort: 80
     - host: domain1.com
      http:
        paths:
          - path: /myapp/(.*)
            pathType: ImplementationSpecific
            backend:
              serviceName: ui-myapp-proxy-mgmt-webapp
              servicePort: 80

Note: currently myApp is deployed in html\myApp directory of apache in the service image

Samdeesh
  • 905
  • 11
  • 23

0 Answers0