-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Allow configuring the default base URI with a DSN #36651
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced May 1, 2020
Nyholm
reviewed
May 1, 2020
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
I like this PR. Im 👍 on the implementation. I just have the one question about naming things =) |
Nyholm
reviewed
May 3, 2020
ogizanagi
approved these changes
May 4, 2020
Nyholm
approved these changes
May 4, 2020
fabpot
approved these changes
May 4, 2020
Thank you @nicolas-grekas. |
fabpot
added a commit
that referenced
this pull request
May 5, 2020
…r assets (nicolas-grekas) This PR was merged into the 5.1-dev branch. Discussion ---------- [FrameworkBundle] use the router context by default for assets | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follows #36651 and #21027 This means assets are going to be configured automatically most of the time. The only case where `asset.request_context.base_path` is useful is when the webserver still keeps a `/index.php/` in URLs. (I'm not sure if the doc should tell ppl to use the parameter, or if we should tell ppl to improve the config of their server...) Commits ------- 1ac5f68 [FrameworkBundle] use the router context by default for assets
Merged
nicolas-grekas
added a commit
that referenced
this pull request
Apr 19, 2022
…g slash (Tobion) This PR was merged into the 5.4 branch. Discussion ---------- [Routing] fix router base url when default uri has trailing slash | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | | License | MIT | Doc PR | When the router default uri (feature #36651) has a trailing slash, the generated URLs are wrong. E.g. ```yaml framework: router: default_uri: 'https://example.org/' # this is equivalent URI to 'https://example.org' ``` Generating any absolute URL given this base path currently resulted in double slashes, e.g. `https://example.org//mypage` because the base url is set to `/` and the path info defaults to `/` as well. This is not correct and will result in a 404. The most consistent fix with the rest of symfony is to always rtrim the trailing slashes from the base url. This is already done in the HttpFoundation Request class see https://github.com/symfony/symfony/blob/674ad07a684fe1274ae49d9f4b6294ede3b47b92/src/Symfony/Component/HttpFoundation/Request.php#L849 So I think it makes sense to enforce this also on the requestcontext so it is also the case when it does not go through the fromRequest but via fromUri in the CLI. Commits ------- 07136a9 [Routing] fix router base url when default uri has trailing slash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of defining 3-4 parameters, this PR enables using a single DSN to configure the default URL context (for commands mainly):
When using parameters directly, one can now set the same absolute URI in the
router.request_context.base_url
parameter, this will provide the same benefit.