Skip to content

CheckWronglyVersionedBaseUrls middleware not working for Dockerized servers #520

@CasperWA

Description

@CasperWA

The middleware CheckWronglyVersionedBaseUrls cannot properly handle servers that run in Docker and may be proxied through to a different "public" base URL.

The issue here is the reliance on the utility function get_base_url, which will either return the CONFIG.base_url if not None, otherwise it will return the parsed URL without a path.

If the server is running in Docker, it will likely run at http://localhost:5000 or http://0.0.0.0 and be proxied through to the configure base URL, which will also be used in the configuration of the server, i.e., the proxied "public" base URL will be the value of CONFIG.base_url, which it also needs to be for other parts of the server to deliver the correct links (e.g., for pagination, etc.).

A solution here is to try and retrieve the actual base URL that the server understands it is running at if possible from uvicorn. However, since one may use other servers than uvicorn, this is not a general solution. Instead one should perhaps add another configuration entry docker_base_url or local_base_url?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds discussionpriority/highIssue or PR with a consensus of high priorityserverIssues pertaining to the example server implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions