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 <jesse.pretorius@rackspace.co.uk>
This commit is contained in:
Jesse Pretorius 2018-03-11 09:51:54 +00:00 committed by Kevin Carter (cloudnull)
parent 5979a638ea
commit 65f6630823
1 changed files with 4 additions and 0 deletions

View File

@ -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 {