1
0
Files
configuration
flake
hosts
_iso
aluminium
astatine
backup-4
beryllium
carbon
clerie-backup
dn42-il-gw1
dn42-il-gw5
dn42-il-gw6
dn42-ildix-clerie
dn42-ildix-service
gatekeeper
hydra-1
hydra-2
krypton
mail-2
monitoring-3
nonat
osmium
palladium
porter
storage-2
tungsten
web-2
blog.nix
bula22.nix
chaosevents.nix
clerie.nix
configuration.nix
drop.nix
etebase.nix
feeds.nix
fieldpoc.nix
gitea.nix
hardware-configuration.nix
ip.nix
legal.nix
meow.nix
milchinsel.nix
mitel-ommclient2.nix
nix-install.nix
nurausstieg.nix
ping.nix
public.nix
radicale.nix
reichartstrasse.nix
secrets.json
ssh.pub
uptimestatus.nix
wetter.nix
zinc
lib
modules
pkgs
users
.gitignore
README.md
flake.lock
flake.nix
nixfiles/hosts/web-2/ping.nix

49 lines
1.5 KiB
Nix

{ pkgs, ... }:
{
services.nginx.virtualHosts = {
"ping.clerie.de" = {
enableACME = true;
addSSL = true;
root = pkgs.fetchgit {
url = "https://git.clerie.de/clerie/ping.clerie.de.git";
rev = "c9c0849e1f63fd2e3aeeba8ce19ec44065a5d563";
sha256 = "sha256-w6YG8qtuAVR7ET9pI/j8UMhF3JLDywLbD6DbM/Huyzw=";
};
/*
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."= /ping" = {
return = ''201'';
extraConfig = ''
types { } default_type "text/plain; charset=utf-8";
add_header Access-Control-Allow-Origin *;
'';
};
locations."= /nm-check.txt" = {
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";
'';
};
extraConfig = ''
access_log off;
'';
};
};
}