Skip to content

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.

[Fix]: Caddy docker labels do not honor "strip prefix" option

konstchri85d072832229
diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php
index 40eacf5c86..98039ba4b2 100644
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@ -283,6 +283,10 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,
$host_without_www = str($host)->replace('www.', '');
$schema = $url->getScheme();
$port = $url->getPort();
+ $handle = "handle_path"
+ if ( ! $is_stripprefix_enabled){
+ $handle = "handle"
+ }
if (is_null($port) && ! is_null($onlyPort)) {
$port = $onlyPort;
}
@@ -293,12 +297,13 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,
$labels->push("caddy_{$loop}.header=-Server");
$labels->push("caddy_{$loop}.try_files={path} /index.html /index.php");
+
if ($port) {
- $labels->push("caddy_{$loop}.handle_path.{$loop}_reverse_proxy={{upstreams $port}}");
+ $labels->push("caddy_{$loop}.{$handle}.{$loop}_reverse_proxy={{upstreams $port}}");
} else {
- $labels->push("caddy_{$loop}.handle_path.{$loop}_reverse_proxy={{upstreams}}");
+ $labels->push("caddy_{$loop}.{$handle}.{$loop}_reverse_proxy={{upstreams}}");
}
- $labels->push("caddy_{$loop}.handle_path={$path}*");
+ $labels->push("caddy_{$loop}.{$handle}={$path}*");
if ($is_gzip_enabled) {
$labels->push("caddy_{$loop}.encode=zstd gzip");
}