-
Notifications
You must be signed in to change notification settings - Fork 49
Description
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?