fix: traefik labels for multiport deployments

This commit is contained in:
Andras Bacsai 2023-10-04 15:39:23 +02:00
parent 45f9def0f6
commit d4a7d0d25f

View File

@ -157,11 +157,13 @@ function fqdnLabelsForTraefik(Collection $domains, $container_name, $is_force_ht
$path = $url->getPath();
$schema = $url->getScheme();
$port = $url->getPort();
$slug = Str::slug($host . $path);
$http_label = "{$container_name}-{$slug}-http";
$https_label = "{$container_name}-{$slug}-https";
$http_label = "{$container_name}-http";
$https_label = "{$container_name}-https";
if ($port) {
$http_label = "{$http_label}-{$port}";
$https_label = "{$https_label}-{$port}";
}
if ($schema === 'https') {
// Set labels for https
$labels->push("traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");