Add default 404 redirect for Caddy proxy
This commit is contained in:
parent
0d4ad05c1c
commit
a06de9682c
@ -130,6 +130,22 @@ public function setupDefault404Redirect()
|
||||
$default_redirect_file = "$dynamic_conf_path/default_redirect_404.caddy";
|
||||
}
|
||||
if (empty($redirect_url)) {
|
||||
if ($proxy_type === 'CADDY') {
|
||||
$conf = ":80, :443 {
|
||||
respond 404
|
||||
}";
|
||||
$conf =
|
||||
"# This file is automatically generated by Coolify.\n" .
|
||||
"# Do not edit it manually (only if you know what are you doing).\n\n" .
|
||||
$conf;
|
||||
$base64 = base64_encode($conf);
|
||||
instant_remote_process([
|
||||
"mkdir -p $dynamic_conf_path",
|
||||
"echo '$base64' | base64 -d > $default_redirect_file",
|
||||
], $this);
|
||||
$this->reloadCaddy();
|
||||
return;
|
||||
}
|
||||
instant_remote_process([
|
||||
"mkdir -p $dynamic_conf_path",
|
||||
"rm -f $default_redirect_file",
|
||||
|
Loading…
Reference in New Issue
Block a user