Open goors opened 2 years ago
I think you have a config like this
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- host: test.domain.com
http:
paths:
- path: /nuget(/|$)(.*) # test.domain.com/nuget/api/v3 would redirect to the baget-service:80/api/v3
pathType: Prefix
backend:
service:
name: baget-service
port:
number: 80
you should change to something like this
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1/$3
spec:
rules:
- host: test.domain.com
http:
paths:
- path: /(nuget)(/|$)(.*) # test.domain.com/nuget/api/v3 would redirect to the baget-service:80/nuget/api/v3
pathType: Prefix
backend:
service:
name: baget-service
port:
number: 80
This works for the requests coming from the external to the internal of the service, but not for the website. Like every websites hosted on in subpath, the html points to resources directly on / and doesn't work since this is another application.
Loading failed for the <script> with source “https://mydomain.com/static/js/2.efb0bbbd.chunk.js”. [nuget:1:1](https://mydomain.com/nuget)
Loading failed for the <script> with source “https://mydomain.com/static/js/main.1a468764.chunk.js”.
Is using different subdomains the only solution?
I have Kubernetes with ingress config:
path: /nuget(/|$)(.*)
I thought that using PathBase as env variable with resolve issue, but it is not.
In this case I thought setting PathBase=/nuget with resolve this but when I got to mydomain.com/nuget/v3/index.json In response JSON, I have mydomain.com/api/v2/package in instead of mydomain.com/nuget/api/v2/package.
What am I missing here?