繁体   English   中英

Nginx 入口未重定向到 https

[英]Nginx ingress not redirecting to https

我在我的 EKS 集群中运行了 argo cd,现在我想在顶部添加 DNS 名称,以便我可以使用域轻松访问它。

我可以配置,但是当我在浏览器中访问 url 时,它总是进入 https(非安全)模式。 我在这里阅读了几个相同的问题,但没有直接相关的问题。

下面是我试过的入口

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argocd
  namespace: argocd
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    nignx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
  ingressClassName: nginx
  rules:
  - host: argocd.example.com
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: argocd-server
            port:
              number: 443
  tls:
  - hosts:
    - argocd.example.com
    secretName: argocd-secret

如果我试图删除注释nginx.ingress.kube.netes.io/backend-protocol: "HTTPS"那么我会得到一个不同的错误,它与循环中的重定向相关。

我不确定我还需要添加什么到这里的入口,以便它可以路由到https而不是http

nginx.ingress.kube.netes.io/ssl-passthrough在 TCP 级别上工作,而不是在 HTTP 级别上工作。 因此, nignx.ingress.kube.netes.io/force-ssl-redirect -ssl-redirect 应该被ssl-passthrough注解失效。

检查更多信息: https://github.com/kube.netes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#ssl-passthrough

尝试删除ssl-passthrough注释,它应该会按预期工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM