at 23.11-pre 657 B view raw
1import ./make-test-python.nix ({ pkgs, ... }: { 2 name = "nginx-globalredirect"; 3 4 nodes = { 5 webserver = { pkgs, lib, ... }: { 6 services.nginx = { 7 enable = true; 8 virtualHosts.localhost = { 9 globalRedirect = "other.example.com"; 10 # Add an exception 11 locations."/noredirect".return = "200 'foo'"; 12 }; 13 }; 14 }; 15 }; 16 17 testScript = '' 18 webserver.wait_for_unit("nginx") 19 webserver.wait_for_open_port(80) 20 21 webserver.succeed("curl --fail -si http://localhost/alf | grep '^Location:.*/alf'") 22 webserver.fail("curl --fail -si http://localhost/noredirect | grep '^Location:'") 23 ''; 24})