fastapi
fastapi copied to clipboard
[BUG] Swagger documents cannot be accessed directly through the browser after setting the proxy using root_path
Privileged issue
- [X] I'm @tiangolo or he asked me directly to create an issue here.
Issue Content
Operating System
Windows
FastAPI Version
0.109.1
Pydantic Version
2.5.3
Python Version
3.9.18
Uvicorn Version
0.27.0
from fastapi import FastAPI
import uvicorn
app = FastAPI()
@app.get('/test')
def test():
return {'test': 'test content'}
if __name__ == '__main__':
uvicorn.run(app='app:app', root_path='/proxy')
When I run the above code, I am unable to access the Swagger document through http://127.0.0.1:8000/docs or http://127.0.0.1:8000/proxy/docs in my browser(Not Found /proxy/openapi.json).