proxies / mirrormanager / download redirect: fix https/http mixing

Fixes https://pagure.io/fedora-infrastructure/issue/9564

download.fedoraproject.org queries mirrormanager for a redirect to a
mirror for the path/request. Before we were just taking any mirror that
mirrormanager had, if it was http or https. This caused requests that
were sent in as https to get a http mirror and error out. So, now we
just redirect http ones to http mirrors and https requests to https
mirrors.

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
Kevin Fenzi 2021-01-06 15:51:08 -08:00
parent 57a7a855b6
commit 765e526a83

View file

@ -10,8 +10,11 @@ RewriteRule (.*) - [F]
RewriteRule ^/$ https://getfedora.org/ [R=302,L]
RewriteRule ^/pub/epel/7Server/(.+) http://localhost:10002/mirrorlist?path=pub/epel/7/$1&redirect=1 [P,QSA,L]
RewriteRule ^/(.+) {{proxyurl}}/mirrorlist?path=$1&redirect=1 [P,QSA,L]
RewriteRule ^/$ {{proxyurl}}/mirrorlist?path=pub/fedora/linux/&redirect=1 [P,QSA,L]
# http connection, return http mirrors
RewriteCond %{HTTPS} "off"
RewriteRule ^/(.+) http://localhost:10002/mirrorlist?path=$1&redirect=1&protocol=http [P,QSA,L]
# https connection, return https mirrors
RewriteCond %{HTTPS} "on"
RewriteRule ^/(.+) http://localhost:10002/mirrorlist?path=$1&redirect=1&protocol=https [P,QSA,L]
ProxyPassReverse / {{proxyurl}}/