Update fun.py
Browse files
fun.py
CHANGED
@@ -4,15 +4,15 @@ import uvicorn
|
|
4 |
import time
|
5 |
app = FastAPI()
|
6 |
time.sleep(10)
|
7 |
-
TARGET_BASE = "http://127.0.0.1:
|
8 |
resp = httpx.get(TARGET_BASE)
|
9 |
-
print(f'RESP:{ resp.json}')
|
10 |
@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"])
|
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)
|
|
|
4 |
import time
|
5 |
app = FastAPI()
|
6 |
time.sleep(10)
|
7 |
+
TARGET_BASE = "http://127.0.0.1:9222" # 替换为你的目标服务器
|
8 |
resp = httpx.get(TARGET_BASE)
|
9 |
+
print(f'RESP:{ resp.Response.json}')
|
10 |
@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"])
|
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.Response.json}')
|
16 |
# if path == "":
|
17 |
# # 拒绝根目录
|
18 |
# return Response(content="Not Found", status_code=status.HTTP_404_NOT_FOUND)
|