Skip to content

Conversation

@YuriiMotov
Copy link
Member

@YuriiMotov YuriiMotov commented Nov 25, 2025

Resolves / related to #12246

It's currently wrongly stated in the docstring for servers parameter, that by-default FastAPI will include / url in case this parameter is not specified or empty list:

If the servers `list` is not provided, or is an empty `list`, the
default value would be a `dict` with a `url` value of `/`.

This is not true (related part of code). In fact it will be an url containing the value of root_path (the mounting point of application), and it will be omitted in the generated openapi schema if the mounting point is /.

This PR fixes the docstring ad adds a "technical details" note in "behind-a-proxy".

This way we keep current behavior and just clarify the docs.
Alternatively we may want to change the behavior to add server with url equals to / instead of omitting servers property in case the app's mounting point is / and servers parameter is not specified by developer

@YuriiMotov YuriiMotov added the docs Documentation about how to use FastAPI label Nov 25, 2025
Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you! I tweaked it a bit, ready now! 🍰

@tiangolo tiangolo enabled auto-merge (squash) December 2, 2025 09:08
@tiangolo tiangolo merged commit dcf0299 into fastapi:master Dec 2, 2025
44 of 45 checks passed
nilslindemann added a commit to nilslindemann/fastapi that referenced this pull request Dec 2, 2025
YuriiMotov added a commit that referenced this pull request Dec 2, 2025
* Sync with #14217

* Sync with #14359

* Sync with #13786

* Sync with #14070

* Sync with #14120

* Sync with #14211

* Sync with #14405

* "to deploy" -> "deployen"

The LLM used that translation a lot ithis convinced me that "deployen" it is the better word. "bereitstellen" (or "ausliefern") is still used for "to serve".

---------

Co-authored-by: Motov Yurii <[email protected]>
Co-authored-by: Yurii Motov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation about how to use FastAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants