Update fun.py
Browse files
fun.py
CHANGED
@@ -11,13 +11,14 @@ print(f'RESP:{ resp.json}')
|
|
11 |
async def proxy(request: Request, path: str):
|
12 |
resp = httpx.get(TARGET_BASE)
|
13 |
# 强制Host头为127.0.0.1
|
14 |
-
|
15 |
print(f'RESP:{resp.json}')
|
16 |
# if path == "":
|
17 |
# # 拒绝根目录
|
18 |
# return Response(content="Not Found", status_code=status.HTTP_404_NOT_FOUND)
|
19 |
url = f"{TARGET_BASE}/{path}"
|
20 |
headers = dict(request.headers)
|
|
|
21 |
body = await request.body()
|
22 |
async with httpx.AsyncClient(follow_redirects=True) as client:
|
23 |
resp = await client.request(
|
|
|
11 |
async def proxy(request: Request, path: str):
|
12 |
resp = httpx.get(TARGET_BASE)
|
13 |
# 强制Host头为127.0.0.1
|
14 |
+
|
15 |
print(f'RESP:{resp.json}')
|
16 |
# if path == "":
|
17 |
# # 拒绝根目录
|
18 |
# return Response(content="Not Found", status_code=status.HTTP_404_NOT_FOUND)
|
19 |
url = f"{TARGET_BASE}/{path}"
|
20 |
headers = dict(request.headers)
|
21 |
+
headers["host"] = "127.0.0.1"
|
22 |
body = await request.body()
|
23 |
async with httpx.AsyncClient(follow_redirects=True) as client:
|
24 |
resp = await client.request(
|