code: public function getOptions(Request $request): array
      {
          if (!$this->isCorsRequest($request) || !$this->canRunDbQuery()) {
              return [];
          }
  
          $stmt = $this->connection->prepare("
              SELECT EXISTS (
                  SELECT
                      id
                  FROM
                      tl_page
                  WHERE
                      type = 'root' AND dns = :dns
              )
          ");
  
          $stmt->bindValue('dns', preg_replace('@^https?://@', '', $request->headers->get('origin')));
          $stmt->execute();
  
          if (!$stmt->fetchColumn()) {
              return [];
          }
  
          return [
              'allow_origin' => true,
              'allow_methods' => ['HEAD', 'GET'],
              'allow_headers' => ['x-requested-with'],
          ];
      }
docs: {@inheritdoc}