我正在使用abc.com/foo,并且工作正常,但是无论诸如abc.com/foo/account-login之类的网址,我都需要重定向到abc.com/account-login,但它无法正常工作。请让我知道如何在traefik中设置重写或任何其他注释。
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
traefik.frontend.rule.type: PathPrefixStrip
kubernetes.io/ingress.class: traefik
name: dev-ingress
namespace: dev
spec:
rules:
- host: abc.com
http:
paths:
- backend:
serviceName: dev-service
servicePort: http
path: /foo
status:
loadBalancer: {}
答案 0 :(得分:0)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/rewrite-target: /account-login
name: dev-ingress
namespace: dev
spec:
rules:
- host: abc.com
http:
paths:
- backend:
serviceName: dev-service
servicePort: http
path: /foo
status:
loadBalancer: {}
答案 1 :(得分:0)
这取决于您的背面和配置,但您可以尝试:
删除 traefik.frontend.rule.type: PathPrefixStrip
“ 并设置 path: /
请告诉我它是否有帮助