code: public static function extractDomain(RawRequest $rawRequest)
      {
          $domain = null;
          if (preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i", $rawRequest->getHost(), $matches)) {
              $domain = $matches['domain'];
          }
  
          return $domain;
      }
docs: Extract domain from raw request.
  
  @static
  @param  RawRequest $rawRequest base raw request
  @return string     domain