Skip to content

Commit 748b65d

Browse files
committed
Added documentation on how to configure the reverse proxy for a subfolder & Documented the usage of X-Forwared-Prefix
If you want to put a symfony application behind a reverse proxy which is configured the application in a subfolder, then this is supported by setting the non-standard X-Forwarded-Prefix HTTP header. However, this is nowhere documented and no good solution on how to achieve this goal is found on the internet. This commit adds documentation on how to use this header.
1 parent c8cdd53 commit 748b65d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

deployment/proxies.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ enough, as it will only trust the node sitting directly above your application
159159
ranges of any additional proxy (e.g. `CloudFront IP ranges`_) to the array of
160160
trusted proxies.
161161

162+
Reverse proxy in a subpath / subfolder
163+
--------------------------------------
164+
165+
If you configure the reverse proxy in such a way that the Symfony application is
166+
mapped in a subpath / subfolder instead of the root path of the web host, you will need to
167+
pass the prefix to Symfony by setting the ``X-Forwarded-Prefix`` header.
168+
This is required for Symfony to generate the correct URLs.
169+
170+
This can normally be configured in your reverse proxy configuration.
171+
If the application is served via the reverse proxy under a URL like
172+
``https://localhost/app/``, then ``X-Forwarded-Prefix`` must be set to ``/app/`` by the
173+
reverse proxy.
174+
162175
Custom Headers When Using a Reverse Proxy
163176
-----------------------------------------
164177

0 commit comments

Comments
 (0)