CheckWronglyVersionedBaseUrls middleware not working for Dockerized servers #520
Labels
bug
Something isn't working
needs discussion
priority/high
Issue or PR with a consensus of high priority
server
Issues pertaining to the example server implementation
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 theCONFIG.base_url
if notNone
, 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
orhttp://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 ofCONFIG.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 thanuvicorn
, this is not a general solution. Instead one should perhaps add another configuration entrydocker_base_url
orlocal_base_url
?The text was updated successfully, but these errors were encountered: