Skip to content

Commit 50e0358

Browse files
committed
Support X-Forwarded-Context and X-ProxyContextPath.
1 parent b83eb8a commit 50e0358

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

nbserverproxy/handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ async def proxy(self, port, proxied_path):
235235

236236
headers = self.proxy_request_headers()
237237

238+
# Some applications check X-Forwarded-Context and X-ProxyContextPath
239+
# headers to see if and where they are being proxied from. We set
240+
# them to be {base_url}/proxy/{port}.
241+
headers['X-Forwarded-Context'] = headers['X-ProxyContextPath'] = \
242+
url_path_join(self.base_url, 'proxy', port)
243+
238244
req = httpclient.HTTPRequest(
239245
client_uri, method=self.request.method, body=body,
240246
headers=headers,

0 commit comments

Comments
 (0)