Add default 404 redirect for Caddy proxy
This commit is contained in:
parent
0d4ad05c1c
commit
a06de9682c
@ -130,6 +130,22 @@ class Server extends BaseModel
|
|||||||
$default_redirect_file = "$dynamic_conf_path/default_redirect_404.caddy";
|
$default_redirect_file = "$dynamic_conf_path/default_redirect_404.caddy";
|
||||||
}
|
}
|
||||||
if (empty($redirect_url)) {
|
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([
|
instant_remote_process([
|
||||||
"mkdir -p $dynamic_conf_path",
|
"mkdir -p $dynamic_conf_path",
|
||||||
"rm -f $default_redirect_file",
|
"rm -f $default_redirect_file",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user