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

Skip to content

Router concat host on url generation with absolute_path setted if router.request_context.host setted too #21971

Closed
@cirovargas

Description

@cirovargas
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.1.9

Facts:

I configured in my parameter.yml the router variables: host and scheme

router.request_context.host: mydomain11.com
router.request_context.scheme: http

I want to generate a route link to email from another host so I do this:

$mylink = 'http: //mydomain22.com'.$this-> generateUrl (' my_route ',array(), UrlGeneratorInterface :: ABSOLUTE_PATH)

I know the right thing is set the host in context (but it is not the case here)

The bug is that even i need an absolute path, if the current host is different from the configured in the parameters the router concat the host:

Symfony\Component\Routing\Generator\UrlGenerator

if ($routeHost !== $host) {
                    $host = $routeHost;
                    if (self::ABSOLUTE_URL !== $referenceType) {
                        $referenceType = self::NETWORK_PATH;
                    }
                }

Whenever i want to generate an absolute path the router should ignore any host parameter

That's right? If no i can do a pull request

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions