{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/14615","labels_url":"https://api.github.com/repos/symfony/symfony/issues/14615/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/14615/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/14615/events","html_url":"https://github.com/symfony/symfony/issues/14615","id":75563737,"number":14615,"title":"[Routing] app_dev.php when generating \"externals\" urls on dev environment","user":{"login":"snoob","id":1806237,"avatar_url":"https://avatars.githubusercontent.com/u/1806237?v=3","gravatar_id":"","url":"https://api.github.com/users/snoob","html_url":"https://github.com/snoob","followers_url":"https://api.github.com/users/snoob/followers","following_url":"https://api.github.com/users/snoob/following{/other_user}","gists_url":"https://api.github.com/users/snoob/gists{/gist_id}","starred_url":"https://api.github.com/users/snoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoob/subscriptions","organizations_url":"https://api.github.com/users/snoob/orgs","repos_url":"https://api.github.com/users/snoob/repos","events_url":"https://api.github.com/users/snoob/events{/privacy}","received_events_url":"https://api.github.com/users/snoob/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-12T11:10:00Z","updated_at":"2015-05-12T12:17:29Z","closed_at":null,"body":"Hi. I wanted to use the router to generate \"externals\" url. \r\nHere is my config : \r\n``` yml\r\n#routing.yml\r\nexternal:\r\n    resource: \"@MyBundle/Resources/config/routing/external.yml\"\r\n    host: \"external.host.com\"\r\n```\r\n``` yml\r\n#external.yml\r\nroute1:\r\n    path: \"/path1.html\"\r\nroute2:\r\n    path: \"/path2.html\"\r\n```\r\n`{{ url('route1', {language: 'app.request.locale'}) }}`  on my twig template generates an unexisting  url : http://external.host.com/app_dev.php/path1.html\r\n\r\nAn easy fix will be to force `baseUrl` to be empty after the test the `$routeHost !== $host` on the `UrlGenerator` (line 252) but if we use a symfony application hostname we will lose the app_dev.php so i think it's a bad idea.\r\n\r\nI found 2 others solutions :\r\n- Be able to override some `RequestContext` values.\r\n- Force a route to be generated without app_dev.php\r\n\r\nI'm aware that few developers use the router for this but i think these solutions can profit to the others.\r\nWhat do you think about this? \r\n\r\nPS : I've solved my problem with a parameter `_external` on my routes and an `UrlGenerator:doGenerate` override. This solution doesn't satisfy me at all. I store the `basePath` on a variable, i override it, i generate my route and i put the old `basePath` back. \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/101255666","html_url":"https://github.com/symfony/symfony/issues/14615#issuecomment-101255666","issue_url":"https://api.github.com/repos/symfony/symfony/issues/14615","id":101255666,"user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T12:17:29Z","updated_at":"2015-05-12T12:17:29Z","body":"Forcing to use an empty base url on host mismatch is not a fix. It will break the normal usage of the router.\r\n\r\nGenerating URLs for an external system based on the request context of the current system is a broken setup (any other thing depending on the request context could break, not only the base url. for instance, the scheme and port might need to be different too).\r\n\r\nIMO, the only clean way to generate urls for an external system would be to use a separate UrlGenerator instance, with its own RequestContext, instead of defining these URLs in the router of your application (which might also do weird things for the route matching)"}}