-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow override of default host at controller level #58477
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
Comments
Defining settings on a route import is not about setting default values. It is about overriding the imported value. That's why your host on the specific controller does not work: it gets overridden by the host set when importing routes. |
Ok, but is there a way to set a default value then? I couldn't find one. |
no, we don't have a way to set default values right now (except a custom loader that would instantiate the Route object with different settings) |
Ok, well I think that would be a useful feature to have, it don't believe the use case is that rare. |
Thank you for this suggestion. |
Could I get a reply or should I close this? |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
Description
Hello,
I've been asked that two pages of a website manage use a specific domain. I thought naively that it would be as simple as adding a default host in config/routes/annotations.yaml and override them in the specific controllers that need to use a different host but it's not the case. The host at controller level is simply ignored. I could have created some kind of custom route loader to manage that, which seems pretty overkill for a simple content website, so I had to specify the domain for every controller. Besides this being annoying, it means me and my coworkers will have to remember to specify the domain every time a new controller is added.
It would be nice if it was possible to simply override the host (or other parameters) of a route when they have been defined in the global config. This in my opinion would be the logical expected behavior.
Example
No response
The text was updated successfully, but these errors were encountered: