gpt4 book ai didi

nginx - ingress-nginx 永久重定向 301 不工作

转载 作者:行者123 更新时间:2023-12-01 07:39:10 24 4
gpt4 key购买 nike

UPDATE: This problem solved itself. I can't tell why. I just tried again the next day and it worked with the config below.

我正在使用 "ingress-nginx"入口 Controller (v.0.12.0)。除permanent redirects 外,它工作正常.

为了将 foo.example.com 重定向到 https://google.com 我应用了以下入口配置:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
# nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/permanent-redirect: "https://google.com"
name: redirect-test
namespace: default
spec:
rules:
- host: foo.example.com
http:
paths:
- backend:
serviceName: default-backend
servicePort: 80
tls:
- hosts:
- foo.example.com
secretName: domains-tls

但是如果我在浏览器中输入 foo.example.com 我会得到这个:

We're sorry, but we were unable to process the redirection request for the site you are attempting to access.

If you feel that you are receiving this message in error, please check the URL and try your request again.

UT

(RF)

有人知道这里出了什么问题吗?

最佳答案

我遇到了同样的问题,

我通过将 nginx-ingress chart 从 nginx-ingress-0.8.13 升级到 nginx-ingress-0.22.0 来修复它

我假设 0.8.13 中不存在永久重定向注释 nginx.ingress.kubernetes.io/permanent-redirect

所以要么 helm 升级你的图表,要么直接升级你的 nginx-ingress。

关于nginx - ingress-nginx 永久重定向 301 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49673057/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com