Skip to content

Host regex not matching #6848

@MichaelHindley

Description

@MichaelHindley

Following http://symfony.com/doc/master/components/routing/hostname_pattern.html

Adding a Host Regex to Imported Routes¶
You can set a host regex on imported routes:

# app/config/routing.yml
acme_hello:
    resource: "@AcmeHelloBundle/Resources/config/routing.yml"
    host:     "hello.example.com"

The host hello.example.com will be set on each route loaded from the new routing resource.

Trying this with:

acme_hello:
    resource: "@AcmeHelloBundle/Resources/config/routing.yml"
    host: "/.domain.com|domain.com/"

Fails to match www.domain.com and domain.com, and any other combination.

Debug:

preg_match('/.domain.com |domain.com /', 'www.domain.com', $result);
var_dump($result)
array (size=1)
  0 => string '.domain.com'

Does symfony use something else than preg_match internally or am i missing something ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions