From 65f66308234bad2da0b1d091e685de98a9b28308 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Sun, 11 Mar 2018 09:51:54 +0000 Subject: [PATCH] Use correct protocol for pypi reverse proxy When reverse proxying pypi the current implementation uses https to communicate upstream. This works just fine if the upstream pypi server is serving data via https, but causes the handshake to fail if the upstream pypi server is serving via http instead. This patch implements a check to validate the upstream pypi server port set and adapts the reverse proxy configuration appropriately. Change-Id: I1a986fef5bf1e069212bc432c3a775be15df11ef Implements: blueprint python-build-install-simplification Signed-off-by: Jesse Pretorius --- templates/openstack-slushee.vhost.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/openstack-slushee.vhost.j2 b/templates/openstack-slushee.vhost.j2 index d9639eb..e25b470 100644 --- a/templates/openstack-slushee.vhost.j2 +++ b/templates/openstack-slushee.vhost.j2 @@ -25,7 +25,11 @@ server { # http://linuxplayer.org/2013/06/nginx-try-files-on-multiple-named-location-or-server location @pypi { proxy_set_header Host pypi.python.org; + {% if repo_nginx_pypi_upstream | match('.*:443$') %} proxy_pass https://pypi; + {% else %} + proxy_pass http://pypi; + {% endif %} } location /simple {