1 import ./make-test-python.nix ({ pkgs, ... }: {
5 webserver = { pkgs, lib, ... }: {
7 root = pkgs.runCommand "testdir" {} ''
9 echo hello world > "$out/index.html"
14 virtualHosts.lockedroot = {
16 basicAuth.alice = "pwofa";
19 virtualHosts.lockedsubdir = {
21 locations."/sublocation/" = {
23 basicAuth.bob = "pwofb";
31 webserver.wait_for_unit("nginx")
32 webserver.wait_for_open_port(80)
34 webserver.fail("curl --fail --resolve lockedroot:80:127.0.0.1 http://lockedroot")
36 "curl --fail --resolve lockedroot:80:127.0.0.1 http://alice:pwofa@lockedroot"
39 webserver.succeed("curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir")
41 "curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir/sublocation/index.html"
44 "curl --fail --resolve lockedsubdir:80:127.0.0.1 http://bob:pwofb@lockedsubdir/sublocation/index.html"