theraven
theraven

Reputation: 21

ingress-nginx: rewrite without affecting assets

I'm having the following case with ingress-nginx 1.8.0:

I want to redirect the starting page from

domain.com to domain.com/pl

This is working fine when i'm using the following ingress config:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/app-root: /pl
    nginx.ingress.kubernetes.io/rewrite-target: /pl
  labels:
    app.kubernetes.io/managed-by: Helm
  name: rewrite-ingress-config
  namespace: default
spec:
  ingressClassName: ingress-nginx
  rules:
  - host: domain.com
    http:
      paths:
      - backend:
          service:
            name: neos-service
            port:
              number: 8080
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - domain.com
    secretName: domain-tls

I'm using neos cms and all the resources are under e.g.:

domain.com/_Resources/Static/Packages/Neos.Demo/Styles/style.css

so no /pl will be added to that resource, which causes me an 404 for all the stylesheets and javascripts/images.

Is there a way how i can rewrite only the access to /pl for e.g. the first request, which will not cause the above effect?

Thanks! :)

Upvotes: 1

Views: 75

Answers (0)

Related Questions