title: Generate absolute URL with specific scheme in Symfony2
body: <p>I want to generate an absolute URL with a specific scheme (https) in a Symfony2 controller. All the solutions I found point me to <a href="http://symfony.com/doc/current/cookbook/routing/scheme.html" rel="noreferrer">configure the targeted route so that it <em>requires</em> that scheme</a>. But I need the route to remain accessible in http, so I can't set it to require https (in which case http requests are redirected to the corresponding https URL).</p>
  
  <p>Is there a way to generate an URL with, in the scope of that URL generation only, a specific scheme?</p>
  
  <p>I saw that using the <code>'network'</code> keyword generates a "network path"-style URL, which looks like "//example.com/dir/file"; so maybe I can simply do</p>
  
  <pre><code>'https:' . $this-&gt;generateUrl($routeName, $parameters, 'network')
  </code></pre>
  
  <p>But I don't know if this will be robust enough to any route or request context.</p>
  
  <p><em>UPDATE: after investigation in the URL generation code, this "network path" workaround seems fully robust. A network path is generated exactly as an absolute URL, without a scheme before the "//".</em></p>