From d971d8d79d98f060d678fe7dbd38e6909ba28407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean=20Charles=20Del=C3=A9pine?= Date: Mon, 25 May 2026 12:12:29 +0200 Subject: [PATCH] fix: Strip default port from Url Strip default port from Url to avoid redirect_uri mismatches with strict OIDC providers. --- src/Uri/RouteUrlWriter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Uri/RouteUrlWriter.php b/src/Uri/RouteUrlWriter.php index 4507c510..c13a76f8 100644 --- a/src/Uri/RouteUrlWriter.php +++ b/src/Uri/RouteUrlWriter.php @@ -62,6 +62,10 @@ public function absoluteUrlFor(string $routeName, array $params = []): ?string ? 'https' : 'http'; + // Strip default port to avoid redirect_uri mismatches with strict OIDC providers. + $defaultPort = $scheme === 'https' ? '443' : '80'; + $host = preg_replace('/^(.+):' . $defaultPort . '$/', '$1', $host); + return $scheme . '://' . $host . $path; }