You are here

public function Request::isSecure in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::isSecure()

Checks whether the request is secure or not.

This method can read the client protocol from the "X-Forwarded-Proto" header when trusted proxies were set via "setTrustedProxies()".

The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".

If your reverse proxy uses a different header name than "X-Forwarded-Proto" ("SSL_HTTPS" for instance), configure it via "setTrustedHeaderName()" with the "client-proto" key.

Return value

bool

1 call to Request::isSecure()
Request::getScheme in vendor/symfony/http-foundation/Request.php
Gets the request's scheme.

File

vendor/symfony/http-foundation/Request.php, line 1179

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function isSecure() {
  if ($this
    ->isFromTrustedProxy() && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && ($proto = $this->headers
    ->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO]))) {
    return in_array(strtolower(current(explode(',', $proto))), array(
      'https',
      'on',
      'ssl',
      '1',
    ));
  }
  $https = $this->server
    ->get('HTTPS');
  return !empty($https) && 'off' !== strtolower($https);
}