ensureTunnelParamOnRequest($request); return $proceed($request); } /** * If tunnel indicator is in $_GET or REQUEST_URI or header, set it on the request * so later plugins (BaseUrlChecker, RequestPreprocessor skip) see it. */ private function ensureTunnelParamOnRequest(RequestInterface $request): void { $value = $this->getTunnelStoreFromSuperglobals(); if ($value === null) { return; } if (!$request instanceof \Magento\Framework\App\Request\Http) { return; } if ($request->getParam(self::QUERY_PARAM_STORE) !== null) { return; } $request->setParam(self::QUERY_PARAM_STORE, $value); } private function getTunnelStoreFromSuperglobals(): ?string { if (!empty($_GET[self::QUERY_PARAM_STORE])) { $v = trim((string) $_GET[self::QUERY_PARAM_STORE]); if ($v !== '') { return $v; } } $uri = $_SERVER['REQUEST_URI'] ?? ''; if ($uri !== '' && str_contains($uri, self::QUERY_PARAM_STORE . '=')) { $query = str_contains($uri, '?') ? substr($uri, strpos($uri, '?') + 1) : ''; parse_str($query, $params); $v = $params[self::QUERY_PARAM_STORE] ?? ''; if ($v !== '' && trim((string) $v) !== '') { return trim((string) $v); } } $h = $_SERVER[self::SERVER_HEADER] ?? ''; if ($h !== '' && trim((string) $h) !== '') { return trim((string) $h); } return null; } }