【发布时间】:2021-10-16 16:57:24
【问题描述】:
我的方案:
Previous traffic path:
-- 80 --> Ingress -- 80 --> Nginx -- 8123 --> Backend
我已将 Nginx 容器中的监听端口更改为从 k8s 迁移到 OpenShift。 现在我的 Nginx 在端口 8081 而不是 80 上工作。
Current traffic path:
-- 80 --> Ingress -- 8081 --> Nginx -- 8123 --> Backend
我的 nginx.conf:
server {
listen 8081;
server_name frontend;
charset utf8;
}
location /auth {
proxy_pass http://backend:8123;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;
}
***
当我在浏览器中打开 https://<My-test-app>/auth 时,我得到重定向 https://<My-test-app>:8081/auth。
我已经尝试在我的 k8s 支架上解决这个问题,并且我已经做到了。
这些注释非常有用:
nginx.ingress.kubernetes.io/proxy-redirect-from : http://<My-test-app>:8081/
nginx.ingress.kubernetes.io/proxy-redirect-to : https://<My-test-app>/
但是 OpenShift 使用了 HA-Proxy 入口控制器,我找不到任何这样的注释。
也许有人已经解决了这个问题或知道更好的解决方案?
【问题讨论】:
标签: nginx openshift kubernetes-ingress nginx-ingress haproxy-ingress