Browse Source

Add a note in `behinf-a-proxy.md`

pull/14405/head
Yurii Motov 8 months ago
parent
commit
3e6c2c6bdd
  1. 8
      docs/en/docs/advanced/behind-a-proxy.md

8
docs/en/docs/advanced/behind-a-proxy.md

@ -394,6 +394,14 @@ This is a more advanced use case. Feel free to skip it.
By default, **FastAPI** will create a `server` in the OpenAPI schema with the URL for the `root_path`. By default, **FastAPI** will create a `server` in the OpenAPI schema with the URL for the `root_path`.
/// note | Technical Details
The `servers` property in the OpenAPI specification is optional.
If you don't specify the `servers` parameter and `root_path` is equal to `/`, the `servers` property in the generated OpenAPI schema will be omitted entirely. Clients should interpret this as a single server with a `url` value of `/`.
///
But you can also provide other alternative `servers`, for example if you want *the same* docs UI to interact with both a staging and a production environment. But you can also provide other alternative `servers`, for example if you want *the same* docs UI to interact with both a staging and a production environment.
If you pass a custom list of `servers` and there's a `root_path` (because your API lives behind a proxy), **FastAPI** will insert a "server" with this `root_path` at the beginning of the list. If you pass a custom list of `servers` and there's a `root_path` (because your API lives behind a proxy), **FastAPI** will insert a "server" with this `root_path` at the beginning of the list.

Loading…
Cancel
Save