Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the new SYMFONY_* env vars #20289

Open
wants to merge 1 commit into
base: 7.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion deployment/proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ Solution: ``setTrustedProxies()``
---------------------------------

To fix this, you need to tell Symfony which reverse proxy IP addresses to trust
and what headers your reverse proxy uses to send information:
and what headers your reverse proxy uses to send information.

You can do that by setting up the ``SYMFONY_TRUSTED_PROXIES`` and ``SYMFONY_TRUSTED_HEADERS``
environment variables on your machine. Alternatively, you can configure those
using the following configuration options:

.. configuration-block::

Expand Down Expand Up @@ -93,6 +97,11 @@ and what headers your reverse proxy uses to send information:
``private_ranges`` as a shortcut for private IP address ranges for the
``trusted_proxies`` option was introduced in Symfony 7.1.

.. versionadded:: 7.2

Support for the ``SYMFONY_TRUSTED_PROXIES`` and ``SYMFONY_TRUSTED_HEADERS``
environment variables was introduced in Symfony 7.2.

.. caution::

Enabling the ``Request::HEADER_X_FORWARDED_HOST`` option exposes the
Expand Down
14 changes: 12 additions & 2 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ named ``kernel.http_method_override``.
trust_x_sendfile_type_header
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**type**: ``boolean`` **default**: ``false``
**type**: ``boolean`` **default**: ``%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%``

.. versionadded:: 7.2

In Symfony 7.2, the default value of this option was changed from ``false`` to the
value stored in the ``SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER`` environment variable.

``X-Sendfile`` is a special HTTP header that tells web servers to replace the
response contents by the file that is defined in that header. This improves
Expand Down Expand Up @@ -450,7 +455,12 @@ in debug mode.
trusted_hosts
~~~~~~~~~~~~~

**type**: ``array`` | ``string`` **default**: ``[]``
**type**: ``array`` | ``string`` **default**: ``['%env(default::SYMFONY_TRUSTED_HOSTS)%']``

.. versionadded:: 7.2

In Symfony 7.2, the default value of this option was changed from ``[]`` to the
value stored in the ``SYMFONY_TRUSTED_HOSTS`` environment variable.

A lot of different attacks have been discovered relying on inconsistencies
in handling the ``Host`` header by various software (web servers, reverse
Expand Down
Loading