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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
multiple domains
Andras Bacsaib14612aba5b6
diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.phpindex b9b14cb187..bdf5e2dfa8 100644--- a/app/Http/Livewire/Project/Application/General.php+++ b/app/Http/Livewire/Project/Application/General.php@@ -4,6 +4,7 @@ namespace App\Http\Livewire\Project\Application;use App\Models\Application;use Livewire\Component;+use Illuminate\Support\Str;class General extends Component{@@ -75,6 +76,10 @@ class General extends Component{try {$this->validate();+ $domains = Str::of($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {+ return Str::of($domain)->trim()->lower();+ });+ $this->application->fqdn = $domains->implode(',');$this->application->save();} catch (\Exception $e) {return generalErrorHandler($e, $this);diff --git a/app/Jobs/DeployApplicationJob.php b/app/Jobs/DeployApplicationJob.phpindex 243101863f..941077ec2a 100644--- a/app/Jobs/DeployApplicationJob.php+++ b/app/Jobs/DeployApplicationJob.php@@ -378,16 +378,21 @@ COPY --from={$this->application->uuid}:{$this->git_commit}-build /app/{$this->ap$labels[] = 'coolify.type=application';$labels[] = 'coolify.name=' . $this->application->name;if ($this->application->fqdn) {- $url = Url::fromString($this->application->fqdn);- $host = $url->getHost();- $path = $url->getPath();+ $domains = Str::of($this->application->fqdn)->explode(',');$labels[] = 'traefik.enable=true';- if ($path === '/') {- $labels[] = "traefik.http.routers.{$this->application->uuid}.rule=Host(`{$host}`) && Path(`{$path}`)";- } else {- $labels[] = "traefik.http.routers.{$this->application->uuid}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";- $labels[] = "traefik.http.routers.{$this->application->uuid}.middlewares={$this->application->uuid}-stripprefix";- $labels[] = "traefik.http.middlewares.{$this->application->uuid}-stripprefix.stripprefix.prefixes={$path}";+ foreach ($domains as $domain) {+ $url = Url::fromString($domain);+ $host = $url->getHost();+ $path = $url->getPath();+ $slug = Str::slug($url);+ $label_id = "{$this->application->uuid}-{$slug}";+ if ($path === '/') {+ $labels[] = "traefik.http.routers.{$label_id}.rule=Host(`{$host}`) && Path(`{$path}`)";+ } else {+ $labels[] = "traefik.http.routers.{$label_id}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";+ $labels[] = "traefik.http.routers.{$label_id}.middlewares={$label_id}-stripprefix";+ $labels[] = "traefik.http.middlewares.{$label_id}-stripprefix.stripprefix.prefixes={$path}";+ }}}return $labels;diff --git a/resources/views/livewire/project/application/deploy.blade.php b/resources/views/livewire/project/application/deploy.blade.phpindex d2e2cec6db..6ad3f5a716 100644--- a/resources/views/livewire/project/application/deploy.blade.php+++ b/resources/views/livewire/project/application/deploy.blade.php@@ -12,10 +12,6 @@Delete</x-inputs.button><span wire:poll.5000ms='pollingStatus'>@if ($application->status === 'running')- @if (data_get($application, 'fqdn'))- <a target="_blank" href="{{ data_get($application, 'fqdn') }}">Open URL</a>- @endif-@if (data_get($application, 'ports_mappings_array'))@foreach ($application->ports_mappings_array as $port)@if (config('app.env') === 'local')