From 3ff361db44fb8dc2501e5995243c237a32544c97 Mon Sep 17 00:00:00 2001 From: clerie Date: Mon, 7 Mar 2022 12:30:35 +0100 Subject: [PATCH] Add nm check endpoint which simulates a captive portal --- hosts/web-2/ping.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hosts/web-2/ping.nix b/hosts/web-2/ping.nix index 1adc787..9cc1120 100644 --- a/hosts/web-2/ping.nix +++ b/hosts/web-2/ping.nix @@ -11,13 +11,21 @@ types { } default_type "text/plain; charset=utf-8"; ''; }; - locations."/nm-check.txt" = { + 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"; + ''; + }; locations."/" = { return = ''404''; };