Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(domains): sync Docker Compose domains for noindex settings

Andras Bacsai51cab061be1c
diff --git a/app/Traits/HasNoindexDomains.php b/app/Traits/HasNoindexDomains.php
index 7afe0d4f25..f3858cc61d 100644
--- a/app/Traits/HasNoindexDomains.php
+++ b/app/Traits/HasNoindexDomains.php
@@ -58,7 +58,16 @@ trait HasNoindexDomains
private function currentDomains(): Collection
{
- return collect(ValidationPatterns::applicationDomainList($this->fqdn))
+ $domains = collect(ValidationPatterns::applicationDomainList($this->fqdn));
+ $composeDomains = json_decode((string) ($this->getAttributes()['docker_compose_domains'] ?? null), true);
+
+ if (is_array($composeDomains)) {
+ foreach ($composeDomains as $entry) {
+ $domains->push(...ValidationPatterns::applicationDomainList(composeDomainEntryString($entry)));
+ }
+ }
+
+ return $domains
->map(fn (string $domain) => $this->normalizeNoindexDomain($domain));
}
diff --git a/tests/Feature/ApplicationDomainsTest.php b/tests/Feature/ApplicationDomainsTest.php
index 19dca79661..a13b5fdbfd 100644
--- a/tests/Feature/ApplicationDomainsTest.php
+++ b/tests/Feature/ApplicationDomainsTest.php
@@ -2066,6 +2066,28 @@ it('updates search engine indexing from the domains view', function () {
->toBe(['https://staging.example.com']);
});
+it('updates search engine indexing for a git docker compose domain', function () {
+ $this->application->update([
+ 'build_pack' => 'dockercompose',
+ 'fqdn' => null,
+ 'docker_compose_domains' => json_encode([
+ 'web' => ['domain' => 'https://compose.example.com'],
+ ]),
+ ]);
+
+ $component = Livewire::test(Domains::class, ['application' => $this->application->fresh()])
+ ->call('toggleNoindexDomain', 'https://compose.example.com', 'noindex')
+ ->assertDispatched('configurationChanged')
+ ->assertDispatched('success');
+
+ expect($this->application->refresh()->noindexDomains()->all())
+ ->toBe(['https://compose.example.com']);
+
+ $component->call('toggleNoindexDomain', 'https://compose.example.com', 'index');
+
+ expect($this->application->refresh()->noindexDomains()->all())->toBe([]);
+});
+
it('keeps noindex domains when normalizing a custom domain port', function () {
$this->application->update([
'fqdn' => 'https://staging.example.com:8080',