【发布时间】:2018-03-08 21:17:23
【问题描述】:
下面是使用“ProxyPass”和“ProxyPassReverse”的apache反向代理配置sn-p
Listen 1.2.3.4:80
<VirtualHost 1.2.3.4:80>
ProxyPreserveHost On
SSLProxyEngine On
ProxyPass /artifactory https://xxxx.xxxx.xxx/artifactory
ProxyPassReverse /artifactory https://xxxx.xxxx.xxx/artifactory
Listen 1.2.3.4:443
<VirtualHost 1.2.3.4:443>
SSLProxyEngine On
ProxyPreserveHost On
ProxyPass /artifactory https://xxxx.xxxx.xxx/artifactory
ProxyPassReverse /artifactory https://xxxx.xxxx.xxx/artifactory
</VirtualHost>
当我在 wget 命令下运行时,它会以某种方式重定向到 http:
#wget --no-check-certificate "https://xxxx.xxxx.xxx/artifactory/"
--2017-09-27 06:25:50--
https://xxxx.xxxx.xxx/artifactory/
Resolving xxxx.xxxx.xxx... 1.2.3.4
Connecting to xxxx.xxxx.xxx|1.2.3.4|:443... connected.
WARNING: certificate common name “xxxx.xxxx.xxx” doesn't match requested
host name “xxxx.xxxx.xxx”.
HTTP request sent, awaiting response... 302 Found
Location: http://xxxx.xxxx.xxx/artifactory/webapp/ [following]
--2017-09-27 06:25:51--
http://xxxx.xxxx.xxx/artifactory/webapp/
Connecting to xxxx.xxxx.xxx|1.2.3.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1449 (1.4K) [text/html]
Saving to: “index.html.18”
如果我使用“/artifactory/webapp/#/home”运行 wget 命令,它可以在 https 上运行:
wget --no-check-certificate "https://xxxx.xxxx.xxx/artifactory/webapp/#/home"
--2017-09-27 06:12:48-
https://xxxx.xxxx.xxx/artifactory/webapp/
Resolving xxxx.xxxx.xxx... 1.2.3.4
Connecting to xxxx.xxxx.xxx|1.2.3.4|:443... connected.
WARNING: certificate common name “xxxx.xxxx.xxx” doesn't
match requested host name “xxxx.xxxx.xxx”.
HTTP request sent, awaiting response... 200 OK
Length: 1449 (1.4K) [text/html]
Saving to: “index.html.17”
2017-09-27 06:12:49 (73.1 MB/s) - “index.html.17” saved [1449/1449]
我没有在代理配置文件的任何地方定义重定向。
有人能提出这种行为背后的原因吗?以及如何避免将其重定向到 HTTP。
【问题讨论】:
标签: apache reverse-proxy artifactory