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
fix: application domains should be http and https only
Andras Bacsai6ac70d6e1b40
diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.phpindex 75c8feea62..4ff031958c 100644--- a/app/Livewire/Project/Application/General.php+++ b/app/Livewire/Project/Application/General.php@@ -6,6 +6,7 @@ use App\Actions\Application\GenerateConfig;use App\Models\Application;use Illuminate\Support\Collection;use Livewire\Component;+use Spatie\Url\Url;use Visus\Cuid2\Cuid2;class General extends Component@@ -183,9 +184,7 @@ class General extends Component$storage->save();});}-}-}public function loadComposeFile($isInit = false)@@ -242,23 +241,6 @@ class General extends Component}}- public function updatedApplicationFqdn()- {- try {- $this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();- $this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();- $this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {- return str($domain)->trim()->lower();- });- $this->application->fqdn = $this->application->fqdn->unique()->implode(',');- $this->application->save();- } catch (\Throwable $e) {- $originalFqdn = $this->application->getOriginal('fqdn');- $this->application->fqdn = $originalFqdn;- return handleError($e, $this);- }- $this->resetDefaultLabels();- }public function updatedApplicationBuildPack(){@@ -332,7 +314,7 @@ class General extends Componentpublic function set_redirect(){try {- $has_www = collect($this->application->fqdns)->filter(fn ($fqdn) => str($fqdn)->contains('www.'))->count();+ $has_www = collect($this->application->fqdns)->filter(fn($fqdn) => str($fqdn)->contains('www.'))->count();if ($has_www === 0 && $this->application->redirect === 'www') {$this->dispatch('error', 'You want to redirect to www, but you do not have a www domain set.<br><br>Please add www to your domain list and as an A DNS record (if applicable).');@@ -349,15 +331,18 @@ class General extends Componentpublic function submit($showToaster = true){try {- if ($this->application->isDirty('redirect')) {- $this->set_redirect();- }+ Url::fromString($this->application->fqdn, ['http', 'https']);$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {return str($domain)->trim()->lower();});$this->application->fqdn = $this->application->fqdn->unique()->implode(',');+ $this->resetDefaultLabels();++ if ($this->application->isDirty('redirect')) {+ $this->set_redirect();+ }$this->checkFqdns();@@ -420,6 +405,10 @@ class General extends Component$this->application->save();$showToaster && $this->dispatch('success', 'Application settings updated!');} catch (\Throwable $e) {+ $originalFqdn = $this->application->getOriginal('fqdn');+ if ($originalFqdn !== $this->application->fqdn) {+ $this->application->fqdn = $originalFqdn;+ }return handleError($e, $this);} finally {$this->dispatch('configurationChanged');diff --git a/app/Livewire/Project/Application/Preview/Form.php b/app/Livewire/Project/Application/Preview/Form.phpindex e4f100fcfc..9a0b9b8518 100644--- a/app/Livewire/Project/Application/Preview/Form.php+++ b/app/Livewire/Project/Application/Preview/Form.php@@ -31,10 +31,14 @@ class Form extends Componentpublic function generate_real_url(){if (data_get($this->application, 'fqdn')) {- $firstFqdn = str($this->application->fqdn)->before(',');- $url = Url::fromString($firstFqdn);- $host = $url->getHost();- $this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);+ try {+ $firstFqdn = str($this->application->fqdn)->before(',');+ $url = Url::fromString($firstFqdn);+ $host = $url->getHost();+ $this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);+ } catch (\Exception $e) {+ $this->dispatch('error', 'Invalid FQDN.');+ }}}