Getting protocol from the URL in controller

symfony

Solution

To check if request is `https` use:

$request->isSecure()

Check doc for more info

Problem

I Googled it but maybe my search keywords are useless so how can I get URL protocol in controller? IS it http:// or https:// ``` http://whatever.com/app_dev.php/welcome //I need to echo http:// protocol here echo $request->getHost(); //echos whatever.com echo $request->getBaseUrl(); //echos app_dev.php/ ```

Original source