Handle 404 in Caddy
This commit is contained in:
parent
3a561cd1aa
commit
11d6faae70
2 changed files with 43 additions and 34 deletions
|
|
@ -23,27 +23,29 @@
|
||||||
## Matrix federation
|
## Matrix federation
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"jankremer.de:8448" = {
|
"jankremer.de:8448" = {
|
||||||
extraConfig = ''
|
extraConfig = # caddyfile
|
||||||
reverse_proxy localhost:6167
|
''
|
||||||
'';
|
reverse_proxy localhost:6167
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
"jankremer.de" = {
|
"jankremer.de" = {
|
||||||
extraConfig = ''
|
extraConfig = # caddyfile
|
||||||
handle /_matrix/* {
|
''
|
||||||
reverse_proxy localhost:6167
|
handle /_matrix/* {
|
||||||
}
|
reverse_proxy localhost:6167
|
||||||
|
}
|
||||||
|
|
||||||
handle /.well-known/matrix/server {
|
handle /.well-known/matrix/server {
|
||||||
header Content-Type application/json
|
header Content-Type application/json
|
||||||
respond `{"m.server": "jankremer.de:443"}` 200
|
respond `{"m.server": "jankremer.de:443"}` 200
|
||||||
}
|
}
|
||||||
|
|
||||||
handle /.well-known/matrix/client {
|
handle /.well-known/matrix/client {
|
||||||
header Content-Type application/json
|
header Content-Type application/json
|
||||||
header Access-Control-Allow-Origin *
|
header Access-Control-Allow-Origin *
|
||||||
respond `{"m.homeserver": {"base_url": "https://jankremer.de"}}` 200
|
respond `{"m.homeserver": {"base_url": "https://jankremer.de"}}` 200
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,33 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
services.caddy.virtualHosts = {
|
services.caddy.virtualHosts = {
|
||||||
"jankremer.de".extraConfig = ''
|
"jankremer.de".extraConfig = # caddyfile
|
||||||
handle {
|
''
|
||||||
root * /var/www/jankremer.de
|
handle {
|
||||||
file_server
|
root * /var/www/jankremer.de
|
||||||
|
file_server
|
||||||
|
|
||||||
@static {
|
@static {
|
||||||
path *.css *.js *.woff2 *.woff *.ttf *.png *.jpg *.jpeg *.svg *.ico *.webp
|
path *.css *.js *.woff2 *.woff *.ttf *.png *.jpg *.jpeg *.svg *.ico *.webp
|
||||||
|
}
|
||||||
|
header @static Cache-Control "public, max-age=31536000, immutable"
|
||||||
|
|
||||||
|
@html {
|
||||||
|
path *.html
|
||||||
|
}
|
||||||
|
header @html Cache-Control "no-cache"
|
||||||
|
|
||||||
|
handle_errors {
|
||||||
|
rewrite * /404.html
|
||||||
|
file_server
|
||||||
|
}
|
||||||
}
|
}
|
||||||
header @static Cache-Control "public, max-age=31536000, immutable"
|
'';
|
||||||
|
|
||||||
@html {
|
"jankremer.eu".extraConfig = # caddyfile
|
||||||
path *.html
|
''
|
||||||
}
|
redir https://jankremer.de{uri} permanent
|
||||||
header @html Cache-Control "no-cache"
|
'';
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
"jankremer.eu".extraConfig = ''
|
|
||||||
redir https://jankremer.de{uri} permanent
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue