code: private function isCorsRequest(Request $request): bool
      {
          return $request->headers->has('Origin')
              && $request->headers->get('Origin') !== $request->getSchemeAndHttpHost()
          ;
      }
docs: Checks if the request has an Origin header.