Spaces:
BG5
/
Running

BG5 commited on
Commit
3cd7e0d
·
verified ·
1 Parent(s): e66f400

Update fun.py

Browse files
Files changed (1) hide show
  1. fun.py +4 -1
fun.py CHANGED
@@ -18,6 +18,7 @@ async def proxy(request: Request, path: str):
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:
@@ -28,10 +29,12 @@ async def proxy(request: Request, path: str):
28
  content=body,
29
  params=request.query_params
30
  )
 
 
31
  return Response(
32
  content=resp.content,
33
  status_code=resp.status_code,
34
- headers=dict(resp.headers)
35
  )
36
 
37
 
 
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
+ host = headers["host"]
22
  headers["host"] = "127.0.0.1"
23
  body = await request.body()
24
  async with httpx.AsyncClient(follow_redirects=True) as client:
 
29
  content=body,
30
  params=request.query_params
31
  )
32
+ headers = dict(resp.headers)
33
+ headers["host"] = host
34
  return Response(
35
  content=resp.content,
36
  status_code=resp.status_code,
37
+ headers=
38
  )
39
 
40