mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
(fix): route x-appwrite-hostname requests to API and handle console redirect edge cases
This commit is contained in:
3 files changed
+10
-10
No files matched your search
+4
-4
@@ -232,15 +232,15 @@ services:
|
||||
- traefik.constraint-label-stack=appwrite
|
||||
- traefik.docker.network=appwrite
|
||||
- traefik.http.services.appwrite_console.loadbalancer.server.port=3000
|
||||
- traefik.http.middlewares.appwrite_console_compat.redirectregex.regex=^(https?://[^/]+)/console(?:/(.*))?$$
|
||||
- traefik.http.middlewares.appwrite_console_compat.redirectregex.replacement=$${1}/$${2}
|
||||
- traefik.http.middlewares.appwrite_console_compat.redirectregex.regex=^(https?://[^/]+)/console(/.*|\?.*)?$$
|
||||
- traefik.http.middlewares.appwrite_console_compat.redirectregex.replacement=$${1}$${2}
|
||||
- traefik.http.middlewares.appwrite_console_compat.redirectregex.permanent=false
|
||||
- traefik.http.routers.appwrite_console_http.entrypoints=appwrite_web
|
||||
- traefik.http.routers.appwrite_console_http.rule=(Host(`${_APP_DOMAIN:-localhost}`) || Host(`${_APP_CONSOLE_DOMAIN:-localhost}`)) && !PathPrefix(`/v1`) && !PathPrefix(`/.well-known`)
|
||||
- traefik.http.routers.appwrite_console_http.rule=(Host(`${_APP_DOMAIN:-localhost}`) || Host(`${_APP_CONSOLE_DOMAIN:-localhost}`)) && !PathPrefix(`/v1`) && !PathPrefix(`/.well-known`) && !HeaderRegexp(`x-appwrite-hostname`, `.+`)
|
||||
- traefik.http.routers.appwrite_console_http.middlewares=appwrite_console_compat
|
||||
- traefik.http.routers.appwrite_console_http.service=appwrite_console
|
||||
- traefik.http.routers.appwrite_console_https.entrypoints=appwrite_websecure
|
||||
- traefik.http.routers.appwrite_console_https.rule=(Host(`${_APP_DOMAIN:-localhost}`) || Host(`${_APP_CONSOLE_DOMAIN:-localhost}`)) && !PathPrefix(`/v1`) && !PathPrefix(`/.well-known`)
|
||||
- traefik.http.routers.appwrite_console_https.rule=(Host(`${_APP_DOMAIN:-localhost}`) || Host(`${_APP_CONSOLE_DOMAIN:-localhost}`)) && !PathPrefix(`/v1`) && !PathPrefix(`/.well-known`) && !HeaderRegexp(`x-appwrite-hostname`, `.+`)
|
||||
- traefik.http.routers.appwrite_console_https.middlewares=appwrite_console_compat
|
||||
- traefik.http.routers.appwrite_console_https.service=appwrite_console
|
||||
- traefik.http.routers.appwrite_console_https.tls=true
|
||||
|
||||
@@ -194,6 +194,6 @@ final class HTTPTest extends Scope
|
||||
$response = $this->client->call(Client::METHOD_GET, '/');
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('text/html', $response['headers']['content-type']);
|
||||
$this->assertStringContainsString('text/html', (string) $response['headers']['content-type']);
|
||||
}
|
||||
}
|
||||
@@ -2214,7 +2214,7 @@ final class SitesCustomServerTest extends Scope
|
||||
$proxyClient->setEndpoint('http://' . $deploymentDomain);
|
||||
$response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false);
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('/auth/preview', (string) $response['headers']['location']);
|
||||
|
||||
$jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0);
|
||||
$apiKey = $jwtObj->encode([
|
||||
@@ -2546,7 +2546,7 @@ final class SitesCustomServerTest extends Scope
|
||||
|
||||
$response = $proxyClient->call(Client::METHOD_GET, '/contact', followRedirects: false);
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('/auth/preview', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('projectId=' . $this->getProject()['$id'], (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('origin=', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('path=%2Fcontact', (string) $response['headers']['location']);
|
||||
@@ -2609,7 +2609,7 @@ final class SitesCustomServerTest extends Scope
|
||||
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
|
||||
], followRedirects: false);
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('/auth/preview', (string) $response['headers']['location']);
|
||||
|
||||
// Failure: User missing
|
||||
$cookie = 'a_session_console=' .$this->getRoot()['session'];
|
||||
@@ -2644,7 +2644,7 @@ final class SitesCustomServerTest extends Scope
|
||||
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
|
||||
], followRedirects: false);
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('/auth/preview', (string) $response['headers']['location']);
|
||||
|
||||
// Failure: Membership missing
|
||||
$email = \uniqid() . 'newuser@appwrite.io';
|
||||
@@ -2684,7 +2684,7 @@ final class SitesCustomServerTest extends Scope
|
||||
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
|
||||
], followRedirects: false);
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']);
|
||||
$this->assertStringContainsString('/auth/preview', (string) $response['headers']['location']);
|
||||
|
||||
$this->cleanupSite($siteId);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user