Skip to content

Added docs on how to configure the reverse proxy for a subfolder & Documented the usage of X-Forwared-Prefix #19128

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

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

jbtronics
Copy link
Contributor

@jbtronics jbtronics commented Nov 11, 2023

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. This was already added in Symfony 5.2. 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.

This should apply to all Symfony versions (at least from 5.4 upwards)

@javiereguiluz
Copy link
Member

Let me ask for a quick review to @dbu because I know that David has battled with many proxies, so maybe he can share some insights here. Thanks!

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

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

seems good to me. i never needed to use this functionality myself, but it makes sense.

i think the documentation section could be a bit more concrete to avoid confusion

Reverse proxy in a subpath / subfolder
--------------------------------------

If you configure the reverse proxy in such a way that the Symfony application is
Copy link
Contributor

Choose a reason for hiding this comment

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

if i understand correctly, this is about the proxy routing to symfony for /subpath, but symfony itself running on /? in a way this is the only thing that makes sense for this documentation, nonetheless i would make that more explicit. you could start with the example and explicitly explain that the symfony application runs at /, and give the example of what absolute paths/urls should be.

Copy link
Member

Choose a reason for hiding this comment

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

@jbtronics if possible, please add a phrase or two as a short introduction to the exact problem that this solves, as asked by David. Thanks!

@jbtronics
Copy link
Contributor Author

jbtronics commented Feb 5, 2024

I added an example. I hope the explaination is now a bit more clear and explict. @dbu

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

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

looks correct and understandable now 👍

@jbtronics
Copy link
Contributor Author

@javiereguiluz I've rewrote the first sentences. I hope its more clear now.

@javiereguiluz
Copy link
Member

Jan, this is finally merged! Thanks a lot for contributing this to the docs. It's an uncommon feature ... but folks using this will definitely appreciate your explanation. Thanks also to David for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants