Reputation: 3391
I've configured an Ingress with config:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nuclio-dashboard
namespace: nuclio
spec:
rules:
- host: nuc.local
http:
paths:
- path: /nuclio
backend:
serviceName: nuclio-dashboard
servicePort: 8070
Not when I go to nuc.local/nuclio
I'm getting a response but the page requests js and css files at:
http://nuc.local/assets/css/vendor-fc43143698.css Failed to load resource: the server responded with a status of 404 (Not Found)
I want every request mage from /nuclio
to /
to go to /nuclio
.
How can I accomplish this?
Upvotes: 0
Views: 392
Reputation: 5041
Assuming you're using Traefik v2, you need something like a redirectRegex Middleware, for traefik to do this. I think it would go like this.
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-redirectregex
namespace: nuclio
spec:
redirectRegex:
regex: ^http://nuc.local/?$$
replacement: http://nuc.local/nuclio/
permanent: true
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
traefik.ingress.kubernetes.io/router.middlewares: nuclio-test-redirectregex@kubernetescrd
name: nuclio-dashboard
namespace: nuclio
spec:
rules:
- host: nuc.local
http:
paths:
- path: /
backend:
serviceName: nuclio-dashboard
servicePort: 8070
Another take on it could be to use the replacePath Middleware, which would then look like this:
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-replacepath
namespace: nuclio
spec:
replacePath:
path: /nclio
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
traefik.ingress.kubernetes.io/router.middlewares: nuclio-test-replacepath@kubernetescrd
name: nuclio-dashboard
namespace: nuclio
spec:
rules:
- host: nuc.local
http:
paths:
- path: /
backend:
serviceName: nuclio-dashboard
servicePort: 8070
Let us know how that goes.
Upvotes: 2