{"record":{"id":"85cc53f868b08155","repo":"symfony/http-kernel","slug":"the-trusted-header-s-is-not-supported","errorCode":null,"errorMessage":"The trusted header \"%s\" is not supported.","messagePattern":"The trusted header \"(.+?)\" is not supported\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Kernel.php","lineNumber":285,"sourceCode":"        $container = $this->container;\n\n        if ($container->hasParameter('kernel.trusted_hosts') && $trustedHosts = $container->getParameter('kernel.trusted_hosts')) {\n            Request::setTrustedHosts(\\is_array($trustedHosts) ? $trustedHosts : preg_split('/\\s*+,\\s*+(?![^{]*})/', $trustedHosts));\n        }\n\n        if ($container->hasParameter('kernel.trusted_proxies') && $container->hasParameter('kernel.trusted_headers') && $trustedProxies = $container->getParameter('kernel.trusted_proxies')) {\n            $trustedHeaders = $container->getParameter('kernel.trusted_headers');\n\n            if (\\is_string($trustedHeaders)) {\n                $trustedHeaders = array_map('trim', explode(',', $trustedHeaders));\n            }\n\n            if (\\is_array($trustedHeaders)) {\n                $trustedHeaderSet = 0;\n\n                foreach ($trustedHeaders as $header) {\n                    if (!\\defined($const = Request::class.'::HEADER_'.strtr(strtoupper($header), '-', '_'))) {\n                        throw new \\InvalidArgumentException(\\sprintf('The trusted header \"%s\" is not supported.', $header));\n                    }\n                    $trustedHeaderSet |= \\constant($const);\n                }\n            } else {\n                $trustedHeaderSet = $trustedHeaders ?? (Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);\n            }\n\n            Request::setTrustedProxies(\\is_array($trustedProxies) ? $trustedProxies : array_map('trim', explode(',', $trustedProxies)), $trustedHeaderSet);\n        }\n    }\n\n    private function getEffectiveBuildDir(): string\n    {\n        return $this->warmupDir ?: $this->getBuildDir();\n    }\n}\n","sourceCodeStart":267,"sourceCodeEnd":302,"githubUrl":"https://github.com/symfony/http-kernel/blob/aa3a39d7286a62cdfea98f0e69c651a3da6e36cf/Kernel.php#L267-L302","documentation":"When booting the kernel with trusted header configuration (framework.trusted_headers), each named header is mapped to a Request::HEADER_* constant. If a configured header name has no matching constant, Request::HEADER_<NAME> is undefined and this InvalidArgumentException is thrown during preBoot, before the app serves requests.","triggerScenarios":"Setting framework.trusted_headers (or Request::setTrustedHeaders via kernel boot) to a name that is not a known X-Forwarded-* header constant, e.g. a typo like 'x-forwarded-hostt' or an empty/invalid string.","commonSituations":"Typos in symfony framework.yaml trusted_headers; upgrading Symfony and using a header name that no longer exists; copying config snippets with made-up header names.","solutions":["Fix the trusted_headers value to valid names: 'x-forwarded-for', 'x-forwarded-port', 'x-forwarded-proto', 'x-forwarded-host', 'x-forwarded-prefix', 'x-forwarded-azure-appservice', or 'x-forwarded-all'","Use the constant name it maps to in Request (HEADER_X_FORWARDED_*) as reference","Remove unknown entries from the config"],"exampleFix":"// before (config)\ntrusted_headers: ['x-forwarded-for', 'x-forwarded-hostt']\n// after\ntrusted_headers: ['x-forwarded-for', 'x-forwarded-host']","handlingStrategy":"validation","validationCode":"$allowed = ['x-forwarded-for','x-forwarded-host','x-forwarded-port','x-forwarded-proto','x-forwarded-prefix','x-forwarded-azure-appservice'];\n$invalid = array_diff($trustedHeaders, $allowed);\nif ($invalid) {\n    throw new \\InvalidArgumentException('Unsupported trusted headers: '.implode(', ', $invalid));\n}","typeGuard":null,"tryCatchPattern":"try {\n    $kernel->boot();\n} catch (\\InvalidArgumentException $e) {\n    if (str_contains($e->getMessage(), 'trusted header')) {\n        // correct the framework.trusted_headers config and retry boot\n    }\n}","preventionTips":["Only use documented x-forwarded-* names in framework.trusted_headers","Validate config with the framework's config linter (bin/console lint:yaml / config dump)","Re-check trusted_headers after Symfony upgrades"],"tags":["config","trusted-proxies","symfony"],"backgroundTag":"invalid-config-value","analyzedSha":"aa3a39d7286a62cdfea98f0e69c651a3da6e36cf","analyzedAt":"2026-09-13T18:03:36.509Z","contentChangedAt":"2026-09-13T18:03:36.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}