From f4c9dc8a5fad0714b9e5cc921fa5dbeaaa362f3c Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 19 May 2016 21:54:58 -0700 Subject: [PATCH] Make sure cherrypy doesn't add the local port twice with http_proxy enabled --- lib/cherrypy/lib/cptools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cherrypy/lib/cptools.py b/lib/cherrypy/lib/cptools.py index 9be571ba..4c8991f8 100644 --- a/lib/cherrypy/lib/cptools.py +++ b/lib/cherrypy/lib/cptools.py @@ -195,7 +195,7 @@ def proxy(base=None, local='X-Forwarded-Host', remote='X-Forwarded-For', if not base: base = request.headers.get('Host', '127.0.0.1') port = request.local.port - if port != 80: + if port != 80 and not base.endswith(':%s' % port): base += ':%s' % port if base.find("://") == -1: