Spaces:
BG5
/
Running

BG5 commited on
Commit
1c9d1a9
·
verified ·
1 Parent(s): e4e2ab1

Update fun.py

Browse files
Files changed (1) hide show
  1. fun.py +2 -1
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
- headers["host"] = "127.0.0.1"
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(