0
votes

Below is apache reverse proxy configuration snippet which uses "ProxyPass" and "ProxyPassReverse"

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>   

when I run below wget command, somehow it redirects to 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”

If I run wget command with "/artifactory/webapp/#/home" it work on 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]

I have not defined redirects anywhere in proxy config file.

Could anyone suggest what could be the reason behind this behavior.? and how can I avoid getting it redirected to HTTP.?

1

1 Answers

0
votes

It seems that you have configured your reverse proxy to listen to the url ending with '/artifactory'. Consider adding the following:

RewriteRule ^/$                     /artifactory/webapp/ [R,L]
RewriteRule ^/artifactory(/)?$      /artifactory/webapp/ [R,L]
RewriteRule ^/artifactory/webapp$   /artifactory/webapp/ [R,L]

Also, are you using Artifactory OSS or Pro? If Pro than you have the option to generate the Apache configurations snippet directly from Artifactory.