Merge pull request #4257 from konstchri/caddy_stripprefix_fix

Caddy stripprefix fix
This commit is contained in:
🏔️ Peak
2024-11-25 14:03:47 +01:00
committed by GitHub

View File

@@ -288,6 +288,10 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,
$host_without_www = str($host)->replace('www.', ''); $host_without_www = str($host)->replace('www.', '');
$schema = $url->getScheme(); $schema = $url->getScheme();
$port = $url->getPort(); $port = $url->getPort();
$handle = "handle_path";
if ( ! $is_stripprefix_enabled){
$handle = "handle";
}
if (is_null($port) && ! is_null($onlyPort)) { if (is_null($port) && ! is_null($onlyPort)) {
$port = $onlyPort; $port = $onlyPort;
} }
@@ -298,12 +302,13 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,
$labels->push("caddy_{$loop}.header=-Server"); $labels->push("caddy_{$loop}.header=-Server");
$labels->push("caddy_{$loop}.try_files={path} /index.html /index.php"); $labels->push("caddy_{$loop}.try_files={path} /index.html /index.php");
if ($port) { if ($port) {
$labels->push("caddy_{$loop}.handle_path.{$loop}_reverse_proxy={{upstreams $port}}"); $labels->push("caddy_{$loop}.{$handle}.{$loop}_reverse_proxy={{upstreams $port}}");
} else { } 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) { if ($is_gzip_enabled) {
$labels->push("caddy_{$loop}.encode=zstd gzip"); $labels->push("caddy_{$loop}.encode=zstd gzip");
} }