Reproduction Demo for #2184

Showing Preview Deployment port issue when using docker-compose

References

See the issue #2184

Code

I just did a little digging. Maybe I looked in the wrong places.

"Normal Application"

For the "normal" application, the configured port from the "Domains" settings section is used and added as a label:

Code Link
    
            if ($schema === 'https') {
                // Set labels for https
                $labels->push("traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
                $labels->push("traefik.http.routers.{$https_label}.entryPoints=https");
                if ($port) {
                    $labels->push("traefik.http.routers.{$https_label}.service={$https_label}");
                    $labels->push("traefik.http.services.{$https_label}.loadbalancer.server.port=$port");
                }
    
  

Preview Deployment

I see that the domain is replaced with the preview domain template, but I cannot find a port section.

Code Link
    
        $fqdn = generateFqdn($this->application->destination->server, $this->application->uuid);
        $url = Url::fromString($fqdn);
        $template = $this->application->preview_url_template;
        $host = $url->getHost();
        $schema = $url->getScheme();
        $random = new Cuid2;
        $preview_fqdn = str_replace('{{random}}', $random, $template);
        $preview_fqdn = str_replace('{{domain}}', $host, $preview_fqdn);
        $preview_fqdn = str_replace('{{pr_id}}', $preview->pull_request_id, $preview_fqdn);
        $preview_fqdn = "$schema://$preview_fqdn";
        $preview->fqdn = $preview_fqdn;
        $preview->save();
        $this->dispatch('success', 'Domain generated.');