Merge pull request #9553 from appwrite/feat-fix-308-redirect

Feat fix 308 redirect
This commit is contained in:
Matej Bačo 2025-03-27 14:05:36 +01:00 committed by GitHub
commit aedfe0352d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 2 deletions

4
composer.lock generated
View file

@ -8507,7 +8507,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -8531,5 +8531,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}

View file

@ -2430,4 +2430,38 @@ class SitesCustomServerTest extends Scope
$this->cleanupSite($siteId);
}
public function testPermanentRedirect(): void
{
$siteId = $this->setupSite([
'siteId' => ID::unique(),
'name' => 'Sub project site',
'framework' => 'other',
'buildRuntime' => 'node-22',
'outputDirectory' => './'
]);
$this->assertNotEmpty($siteId);
$domain = $this->setupSiteDomain($siteId);
$this->assertNotEmpty($domain);
$deploymentId = $this->setupDeployment($siteId, [
'code' => $this->packageSite('sub-directories'),
'activate' => 'true'
]);
$this->assertNotEmpty($deploymentId);
$proxyClient = new Client();
$proxyClient->setEndpoint('http://' . $domain);
$response = $proxyClient->call(Client::METHOD_GET, '/');
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString('Sub-directory index', $response['body']);
$response1 = $proxyClient->call(Client::METHOD_GET, '/project1');
$this->assertEquals(200, $response1['headers']['status-code']);
$this->assertStringContainsString('Sub-directory project1', $response1['body']);
$response2 = $proxyClient->call(Client::METHOD_GET, '/project1/');
$this->assertEquals(200, $response2['headers']['status-code']);
$this->assertStringContainsString('Sub-directory project1', $response2['body']);
$this->cleanupSite($siteId);
}
}

View file

@ -0,0 +1,5 @@
<html lang="en">
<body>
<p>Sub-directory index</p>
</body>
</html>

View file

@ -0,0 +1,5 @@
<html lang="en">
<body>
<p>Sub-directory project1</p>
</body>
</html>