2022-10-17 23:03:09 +02:00
|
|
|
{ pkgs, ... }:
|
2022-02-26 16:14:07 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"ping.clerie.de" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
2022-10-17 23:03:09 +02:00
|
|
|
root = pkgs.fetchgit {
|
2022-08-25 23:22:05 +02:00
|
|
|
url = "https://git.clerie.de/clerie/ping.clerie.de.git";
|
|
|
|
rev = "c9c0849e1f63fd2e3aeeba8ce19ec44065a5d563";
|
2022-10-17 23:03:09 +02:00
|
|
|
sha256 = "sha256-w6YG8qtuAVR7ET9pI/j8UMhF3JLDywLbD6DbM/Huyzw=";
|
2022-08-25 23:22:05 +02:00
|
|
|
};
|
|
|
|
/*
|
2022-02-26 16:14:07 +01:00
|
|
|
locations."= /" = {
|
|
|
|
return = ''200 "This domain is used for connectivity checking and captive portal detection\n"'';
|
|
|
|
extraConfig = ''
|
|
|
|
types { } default_type "text/plain; charset=utf-8";
|
|
|
|
'';
|
|
|
|
};
|
2022-08-25 23:22:05 +02:00
|
|
|
*/
|
|
|
|
locations."= /ping" = {
|
|
|
|
return = ''201'';
|
|
|
|
extraConfig = ''
|
|
|
|
types { } default_type "text/plain; charset=utf-8";
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
'';
|
|
|
|
};
|
2022-03-07 12:30:35 +01:00
|
|
|
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";
|
|
|
|
'';
|
|
|
|
};
|
2022-03-07 12:30:35 +01:00
|
|
|
# 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
|
|
|
extraConfig = ''
|
|
|
|
access_log off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|