Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
37 lines
1.2 KiB
Nix
37 lines
1.2 KiB
Nix
import ./make-test-python.nix {
|
|
name = "nginx-more-headers";
|
|
|
|
nodes = {
|
|
webserver = { pkgs, ... }: {
|
|
services.nginx = {
|
|
enable = true;
|
|
|
|
virtualHosts.test = {
|
|
locations = {
|
|
"/".return = "200 blub";
|
|
"/some" = {
|
|
return = "200 blub";
|
|
extraConfig = ''
|
|
more_set_headers "Referrer-Policy: no-referrer";
|
|
'';
|
|
};
|
|
};
|
|
extraConfig = ''
|
|
more_set_headers "X-Powered-By: nixos";
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
webserver.wait_for_unit("nginx")
|
|
webserver.wait_for_open_port(80)
|
|
|
|
webserver.succeed("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test | grep -q \"X-Powered-By: nixos\"")
|
|
webserver.fail("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test | grep -q \"Referrer-Policy: no-referrer\"")
|
|
|
|
webserver.succeed("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test/some | grep -q \"X-Powered-By: nixos\"")
|
|
webserver.succeed("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test/some | grep -q \"Referrer-Policy: no-referrer\"")
|
|
'';
|
|
}
|