I have a Fast API web server running on Windows Server 2016 (inside a poetry env shell). And I am trying to hit it from another server but in the same subnet. It times out. But I am able to hit it locally.
Similary, I am running an apache web server python3 -m http.server 8000
and I can hit it successfully.
Why am I able to reach the simple http.server and not the FastAPI (Uvicorn) server?
The windows server 2016 is running IIS.
My FastAPI main.py
file
from fastapi import FastAPI, APIRouter
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get('/')
def health():
return {
"Status": "Success",
"Message": "Server running"
}
Start command - uvicorn main:app --reload --port 8000
. Running this inside a poetry environment shell.