-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
hostname_pattern not working #6821
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
We have changed the name of some important options in Symfony2.2 last week ( #6738 ). You should use |
I tried using only hostname, but then the eror is like this: Is this a bug or is there no functionality to support *.domain.com ? |
|
Tried that already as well, but the route doesn't match then so I figured that wasn't the correct way to do it. You mean "*.domain.com", correct? |
I think you have to use something like this:
|
That gives a malformed YAML error, Tried these to no success: doesnt match "cykelverkstad.nu"bike: fails with no route found on *.cykelverkstad.nu and cykelverkstad.nubike: fails with missing mandatory parameterbike: fails with no route foundbike: Seems like I'm either missing something very basic, or it's not that easy to add a route for "*domain.com". |
Use a requirement like this:
|
hostname: {any} When going to www.domain.com results in: [1/2] MissingMandatoryParametersException: Some mandatory parameters are missing ("any") to generate a URL for route "domain_homepage". |
The first part of the report is just bad usage and the second part a duplicate of #6857. |
Either way, there is still no way to match anything.domain.anything |
You can match anything in the domain you want. You just need to understand how its working. |
I'm not talking about {subdomain}.domain.{tld}, I'm talking about {}.domain.{}, where * = anything, without being defined in configuration somewhere. The original error was solved long ago and the discussion has been revolving about matching .domain.. Like, I have a service where the subdomain is always a clients username, out of several thousand, the main domain is always the same, and the tld can be any of over 50 different. If I'm missing something in the Symfony 2 docs and on the Github discussions then it's of course my own fault, but judging by other peoples experiences and comments, this is not actually possible. I may not be the best at programming , since I'm on the business side of things, but I like to think of myself on at least a junior dev level purely out of necessity to understand my employees. English is my third language but I always try to report any faults I find and things that I feel can be improved even though I lack the knowledge to debug it in depth myself, to try and give back to the people that provide the tools that pay for my house. Having said that, we still haven't found a way to match ANY subdomain, permit it to be empty and have any tld, with a single route rule. We have of course found workarounds but the way we do it now seems weird and backasswards(settings apache vars) in this day and age. |
The thing is that optional placeholders are not implemented yet for the host. |
Trying to use hostname_pattern as per http://symfony.com/doc/master/components/routing/hostname_pattern.html
like this:
routing.yml
using this composer.json require:
Debug-bar shows symfony as 2.2.
Getting this error:
[InvalidArgumentException]
The routing file "D:/Dev/wamp/www/empire/app/config\routing.yml" contains u
nsupported keys for "bike": "hostname_pattern". Expected one of: "resource"
, "type", "prefix", "pattern", "path", "hostname", "schemes", "methods", "d
efaults", "requirements", "options".
It says "hostname_pattern" is a unsupported key, even though Symfony is on 2.2.
The text was updated successfully, but these errors were encountered: