fastapi: Incorrect ReDoc resource URL when "app.mount" is used
Describe the bug
There is a bug when API is organized with different versions (FastAPI apps) which mounted via global app.mount.
ReDoc duplicates mount’s prefix. For example, http://127.0.0.1:8000/v1/v1/test.
It works well in default OpenAPI Docs.
Environment:
- OS: [e.g. Linux / Windows / macOS]
- FastAPI Version [e.g. 0.3.0], get it with: 0.40.0
Additional context
import fastapi
from fastapi import APIRouter
app = fastapi.FastAPI(docs_url=None, redoc_url=None)
router = APIRouter()
@router.get("/users/", tags=["users"])
async def read_users():
return [{"username": "Foo"}, {"username": "Bar"}]
apiV1 = fastapi.FastAPI(openapi_prefix="/v1", version="1.0.0")
apiV1.include_router(router)
app.mount("/v1", apiV1)
Screenshot

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (3 by maintainers)
@HacKanCuBa thank you so much for your research!
Oh shit, I got it!
Gonna check it out in the code