Skip to content

Commit

Permalink
Merge pull request #59 from betatim/fix-port-handling
Browse files Browse the repository at this point in the history
Convert port number to string before building URL
  • Loading branch information
minrk committed Dec 10, 2018
2 parents cd31b79 + 1cfa677 commit 2ab2b86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nbserverproxy/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def proxy(self, port, proxied_path):
# headers to see if and where they are being proxied from. We set
# them to be {base_url}/proxy/{port}.
headers['X-Forwarded-Context'] = headers['X-ProxyContextPath'] = \
url_path_join(self.base_url, 'proxy', port)
url_path_join(self.base_url, 'proxy', str(port))

req = httpclient.HTTPRequest(
client_uri, method=self.request.method, body=body,
Expand All @@ -262,7 +262,7 @@ async def proxy(self, port, proxied_path):

for header, v in response.headers.get_all():
if header not in ('Content-Length', 'Transfer-Encoding',
'Content-Encoding', 'Connection'):
'Content-Encoding', 'Connection'):
# some header appear multiple times, eg 'Set-Cookie'
self.add_header(header, v)

Expand Down Expand Up @@ -482,6 +482,7 @@ def patch(self, path):
def options(self, path):
return self.proxy(self.port, path)


def setup_handlers(web_app):
host_pattern = '.*$'
web_app.add_handlers('.*', [
Expand Down

0 comments on commit 2ab2b86

Please sign in to comment.