【问题标题】:How to redirect a user from the root path to a specific base path in Azure Application Gateway如何将用户从根路径重定向到 Azure 应用程序网关中的特定基本路径
【发布时间】:2022-08-24 10:49:16
【问题描述】:

我有一个带有内部负载均衡器 (NGINX) 的 AKS 集群,该集群具有私有 IP 地址。对于公共访问,集群前面有一个 Azure 应用程序网关,它将流量路由到内部负载均衡器。假设应用程序网关的域为https://myapp.mycompany.com,而内部负载均衡器的域为https://cluster.aks-ingress.myapp.mycompany.com

我在集群中托管了几个应用程序,其中之一是 Home 应用程序,它使用 Ingress 给出了路径 /home。如果我从浏览器访问https://myapp.mycompany.com/home,则请求将正确路由到 Home 应用程序。

我的要求是,如果有人试图在他们的浏览器中访问https://myapp.mycompany.com,他们应该被重定向到https://myapp.mycompany.com/home,因为前者没有任何关联的应用程序并且只返回一个 404。我已经搜索了使用应用程序网关执行此操作的方法无济于事。我也尝试过使用 nginx.ingress.kubernetes.io/app-root 注释,但这会将用户重定向到包含内部主机名的 URL(即https://cluster.aks-ingress.myapp.mycompany.com/home)。

    标签: azure kubernetes-ingress azure-aks nginx-ingress azure-application-gateway


    【解决方案1】:

    我通过在根路径(即/)创建部署、服务和入口暂时解决了这个问题,只是为了提供一个带有一些 JavaScript 的 HTML 页面来进行重定向: 'window.location.href = “/home”;'

    【讨论】:

      猜你喜欢
      • 2016-12-03
      • 2021-07-05
      • 2020-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-04
      • 2021-05-31
      相关资源
      最近更新 更多