Fix proxy

This commit is contained in:
Thomas Sileo
2019-08-18 11:48:18 +02:00
parent 3aefaff818
commit 8613cc0206
2 changed files with 5 additions and 0 deletions

2
app.py
View File

@@ -4,6 +4,7 @@ import os
import traceback
from datetime import datetime
from typing import Any
from urllib.parse import urlparse
from uuid import uuid4
import requests
@@ -242,6 +243,7 @@ def proxy(url: str) -> Any:
for k, v in dict(request.headers).items()
if k.lower() not in ["host", "cookie"]
}
req_headers["Host"] = urlparse(url).netloc
resp = requests.get(url, stream=True, headers=req_headers)
app.logger.info(f"proxied req {url}: {resp!r}")