Skip to content

FastAPI fails to trust reverse proxy #316

@KevyVo

Description

@KevyVo

If you run into an error where calls are made through http instead of https, it could be that your FastAPI application isn't trusting the reverse proxy's headers overriding the scheme (the X-Forwarded-Proto header that's passed when it handles a TLS request). We discover this during debugging @GabrielLunesu project. If this a common issue for FastAPI users we should note this somewhere to aid to a smooth deployment.

https://stackoverflow.com/questions/63511413/fastapi-redirection-for-trailing-slash-returns-non-ssl-link

This is also documented on FastAPI: https://fastapi.tiangolo.com/advanced/behind-a-proxy/

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions