Spaces:
Paused
Paused
Update proxy.py
Browse files
proxy.py
CHANGED
@@ -14,8 +14,8 @@ class ProxyRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|
14 |
else:
|
15 |
url = 'http://localhost:{}{}'.format(PROXY_PORT, self.path)
|
16 |
headers = dict(self.headers)
|
17 |
-
|
18 |
-
|
19 |
conn = http.client.HTTPConnection('localhost', PROXY_PORT)
|
20 |
conn.request('GET', url, headers=headers)
|
21 |
response = conn.getresponse()
|
|
|
14 |
else:
|
15 |
url = 'http://localhost:{}{}'.format(PROXY_PORT, self.path)
|
16 |
headers = dict(self.headers)
|
17 |
+
if 'Host' in headers:
|
18 |
+
del headers['Host'] # Remove "Host" header to avoid "HTTP/1.1 400 Bad Request" error
|
19 |
conn = http.client.HTTPConnection('localhost', PROXY_PORT)
|
20 |
conn.request('GET', url, headers=headers)
|
21 |
response = conn.getresponse()
|