diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index d6c4b5ccf..ee2f01b74 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -97,7 +97,7 @@ public function __construct(int $application_deployment_queue_id) if ($this->pull_request_id !== 0) { $this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id); if ($this->application->fqdn) { - $preview_fqdn = getOnlyFqdn(data_get($this->preview, 'fqdn')); + $preview_fqdn = getFqdnWithoutPort(data_get($this->preview, 'fqdn')); $template = $this->application->preview_url_template; $url = Url::fromString($this->application->fqdn); $host = $url->getHost(); diff --git a/app/Models/Service.php b/app/Models/Service.php index 4b66fdf19..ae590f13f 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -377,7 +377,7 @@ public function parse(bool $isNew = false): Collection } else { $number = 0; } - $fqdn = getOnlyFqdn(data_get($fqdns, $number, $fqdns->first())); + $fqdn = getFqdnWithoutPort(data_get($fqdns, $number, $fqdns->first())); $environments = collect(data_get($service, 'environment')); $environments = $environments->map(function ($envValue) use ($value, $fqdn) { $envValue = Str::of($envValue)->replace($value, $fqdn); @@ -393,7 +393,7 @@ public function parse(bool $isNew = false): Collection } else { $number = 0; } - $fqdn = getOnlyFqdn(data_get($fqdns, $number, $fqdns->first())); + $fqdn = getFqdnWithoutPort(data_get($fqdns, $number, $fqdns->first())); $url = Url::fromString($fqdn)->getHost(); $environments = collect(data_get($service, 'environment')); $environments = $environments->map(function ($envValue) use ($value, $url) { diff --git a/app/View/Components/Services/Links.php b/app/View/Components/Services/Links.php index 69fefa7a2..b2cc8618d 100644 --- a/app/View/Components/Services/Links.php +++ b/app/View/Components/Services/Links.php @@ -19,7 +19,7 @@ public function __construct(public Service $service) if ($application->fqdn) { $fqdns = collect(Str::of($application->fqdn)->explode(',')); $fqdns->map(function ($fqdn) { - $this->links->push(getOnlyFqdn($fqdn)); + $this->links->push(getFqdnWithoutPort($fqdn)); }); } if ($application->ports) { diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index e94534fed..63f7fb8b1 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -241,12 +241,13 @@ function base_ip(): string } return "localhost"; } -function getOnlyFqdn(String $fqdn) +function getFqdnWithoutPort(String $fqdn) { $url = Url::fromString($fqdn); $host = $url->getHost(); $scheme = $url->getScheme(); - return "$scheme://$host"; + $path = $url->getPath(); + return "$scheme://$host$path"; } /** * If fqdn is set, return it, otherwise return public ip. diff --git a/resources/views/components/applications/links.blade.php b/resources/views/components/applications/links.blade.php index c38ea185f..c9f9b0de6 100644 --- a/resources/views/components/applications/links.blade.php +++ b/resources/views/components/applications/links.blade.php @@ -19,7 +19,7 @@ class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hove @foreach (Str::of(data_get($application, 'fqdn'))->explode(',') as $fqdn)