mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix(console): allow redirects to the console host when _APP_CONSOLE_URL is set
The default OAuth2 success and failure URLs are built on the console URL, and the callback validates them against the allowed hostnames. A console served on its own host was missing from that list, so the default redirects were rejected.
This commit is contained in:
1 parent
9800cc1ae8
commit
87e0f9c6a2
1 file changed
+6
@@ -251,6 +251,12 @@ return function (Container $context): void {
|
||||
$context->set('allowedHostnames', function (array $platform, Document $project, Document $rule, Document $devKey, Request $request) {
|
||||
$allowed = [...($platform['hostnames'] ?? [])];
|
||||
|
||||
/* Add the console host, the default OAuth2 redirects land on it even when _APP_CONSOLE_URL points elsewhere */
|
||||
$consoleHostname = \parse_url($platform['consoleUrl'] ?? '', PHP_URL_HOST);
|
||||
if (! empty($consoleHostname)) {
|
||||
$allowed[] = $consoleHostname;
|
||||
}
|
||||
|
||||
/* Add platform configured hostnames */
|
||||
if (! $project->isEmpty() && $project->getId() !== 'console') {
|
||||
$platforms = $project->getAttribute('platforms', []);
|
||||
|
||||
Reference in new issue
Block a user