1
0
nixfiles/hosts/web-2/ping.nix

38 lines
1.1 KiB
Nix
Raw Normal View History

2022-02-26 16:14:07 +01:00
{ ... }:
{
services.nginx.virtualHosts = {
"ping.clerie.de" = {
enableACME = true;
addSSL = true;
locations."= /" = {
return = ''200 "This domain is used for connectivity checking and captive portal detection\n"'';
extraConfig = ''
types { } default_type "text/plain; charset=utf-8";
'';
};
locations."= /nm-check.txt" = {
2022-02-26 16:14:07 +01:00
return = ''200 "NetworkManager is online\n"'';
extraConfig = ''
types { } default_type "text_plain; charset=utf-8";
add_header Cache-Control "max-age=0, must-revalidate";
'';
};
# Provide an endpoint to simulate a captive portal redirect for testing
locations."= /nm-check-test.txt" = {
return = ''302 "http://clerie.de"'';
extraConfig = ''
types { } default_type "text_plain; charset=utf-8";
add_header Cache-Control "max-age=0, must-revalidate";
'';
};
2022-02-26 16:14:07 +01:00
locations."/" = {
return = ''404'';
};
extraConfig = ''
access_log off;
'';
};
};
}