title: Generate route with symfony
body: <p>I used an action in a controller to generate routes from web addresses.</p>
  
  <pre><code>url_proxy:
      path:   /proxy
      defaults: { _controller: "PublicartelAppBundle:PlayContent:proxy" }
  </code></pre>
  
  <p>In my controller I used the generator of symfony routes, to do something like this:</p>
  
  <pre><code>public function proxyAction(Request $request){
      $url = $request-&gt;query-&gt;get('url');
      $generateUrl = $this-&gt;get('router')-&gt;generate('url_proxy', array('url' =&gt; $url));
      return new Response(file_get_contents($generateUrl));
  }
  </code></pre>
  
  <p>Then, to prove I did:</p>
  
  <p><strong><a href="http://sgc.lo/public/proxy?url=http://www.google.com" rel="nofollow">http://sgc.lo/public/proxy?url=http://www.google.com</a></strong></p>
  
  <p>But that generates an error:</p>
  
  <p><strong>Warning: file_get_contents (/public/proxy?url=http%3A//www.google.com): failed to open stream: No such file or directory</strong></p>
  
  <p>I think it's because the path is generated: <strong>/public/proxy?url=http%3A//www.google.com</strong> and should be</p>
  
  <p><strong>sgc.lo/public/proxy?url=http%3A//www.google.com</strong></p>
  
  <p>As I can include the prefix 'sgc.lo' in the route to generate?</p>