core-bundle/src/EventListener/RefererIdListener.php
public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$this->scopeMatcher->isBackendMasterRequest($event)) {
            return;
        }

        $request = $event->getRequest();

        if (null === $this->token) {
            $this->token = $this->tokenManager->refreshToken('contao_referer_id');
        }

        $request->attributes->set('_contao_referer_id', $this->token->getValue());
    }
public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$this->scopeMatcher->isBackendMasterRequest($event)) {
            return;
        }

        $request = $event->getRequest();

        if (null === $this->token) {
            $this->token = $this->tokenManager->refreshToken('contao_referer_id');
        }

        $request->attributes->set('_contao_referer_id', $this->token->getValue());
    }
Adds the referer ID to the request.