Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Redirect NGINX/Openshift-位置块重定向到错误端口_Redirect_Nginx_Openshift - Fatal编程技术网

Redirect NGINX/Openshift-位置块重定向到错误端口

Redirect NGINX/Openshift-位置块重定向到错误端口,redirect,nginx,openshift,Redirect,Nginx,Openshift,我在Openshift内的Docker容器中的端口8443上运行了一个NGINX。我还定义了一条Openshift路线,将流量从港口443转发到集装箱的8443 在我尝试访问URL上没有尾随/的位置块之前,这一切都很正常。例如,当我去: https://test.example.com/example JS网络日志显示NGINX试图将我重定向到错误的端口(8443): https://test.example.com:8443/example/ 由于唯一公开的端口是443,因此此操作失败。FWI

我在Openshift内的Docker容器中的端口
8443
上运行了一个NGINX。我还定义了一条Openshift路线,将流量从港口
443
转发到集装箱的
8443

在我尝试访问URL上没有尾随
/
的位置块之前,这一切都很正常。例如,当我去:

https://test.example.com/example

JS网络日志显示NGINX试图将我重定向到错误的端口(
8443
):

https://test.example.com:8443/example/

由于唯一公开的端口是
443
,因此此操作失败。FWIW,添加尾部斜杠(
https://test.example.com/example/

有没有办法让NGINX在重定向期间不使用其内部端口,而是使用客户端使用的端口?以下是我的位置块示例:

location /example {
  proxy_pass https://example.apps.svc.cluster.local:8443;
}

我最终在文件中找到了答案。必须在重定向关闭中包含
端口位于位置块中。例如:

location /example {
  port_in_redirect off;
  proxy_pass https://example.apps.svc.cluster.local:8443;
}