Serve one path internally and a different one externally

8/5/2019

I have an helm chart serving an Mediawiki using apache. Internally it does so from /wiki.

I'd like to run multiply instances and externally reach it from /something-wiki, /other-wiki and so on.

So in other words I'd like to have my ingress controller react to one path and internally go to another path.

I tried the below but it just sends a 301 (moved permanently) which doesn't work since the folder doesn't exists.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /wiki
  name: wiki-environment-erst-env
  namespace: wiki
spec:
  rules:
  - host: aks-dev.something.com
    http:
      paths:
      - backend:
          serviceName: erst-wiki-package
          servicePort: 80
        path: /erst-wiki
  tls:
  - hosts:
    - aks-dev.something.com
    secretName: erst-tls-secret

Any ideas?

-- user672009
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

8/6/2019

If I understand correctly, regexp redirection might work. And the wiki configuration should be handled accordingly.

apiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/use-regex: true name: wiki-environment-erst-env namespace: wiki spec: rules: - host: aks-dev.something.com http: paths: - backend: serviceName: erst-wiki-package servicePort: 80 path: /erst-wiki/.* tls: - hosts: - aks-dev.something.com secretName: erst-tls-secret

-- AYA
Source: StackOverflow