Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to generate url with host ?  #134

@sintanial

Description

@sintanial

Hello, please help me with some problem.
My application divided into many services(bundles). Each service have some domains.
For example

foo_service:
    resource: "@ServiceFooBundle/Resources/config/routing.yml"
    host: "{_host}"
    requirements:
      _host: site1.com|site2.net|site3.org
    prefix:   /

bar_service:
    resource: "@ServiceBarBundle/Resources/config/routing.yml"
    host: "{_host}"
    requirements:
      _host: example1.com|somedomain2.net|test3.org
    prefix:   /

Symfony2 at the present time not supported filling "host" in router. I use this decision symfony/symfony#3965 (comment)

That is set route params in kernel listener like this

public function onKernelRequest(GetResponseEvent $event){
     .....
     $parameters = $request->attributes->get('_route_params');
     $this->router->getContext()->setParameter('_host', $parameters['_host']);
     .....
}

And when i generate route in js, _host replaced by undefined. How to fix this ?

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