KEMBAR78
openapi_url incorrect from behind reverse proxy · Issue #15 · fastapi/fastapi · GitHub
Skip to content

openapi_url incorrect from behind reverse proxy #15

@baodrate

Description

@baodrate

The use case:

I'm running FastAPI behind a nginx reverse proxy, at the path http://localhost/api/. The documentation front ends (swagger and redoc) are expecting openapi.json at http://localhost/openapi.json but it's actually routed at http://localhost/api/openapi.json.

Setting openapi_url to /api/openapi.json also changes the openapi.json path, so now it's looking for (through the proxy) http://localhost/api/api/openapi.json.

Ideally, it'd be great if we could specify the "public path" for the api. That's how e.g. vue does it

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions