python312Packages.pyoverkiz: 1.15.2 -> 1.15.3 (#366663)
[NixPkgs.git] / nixos / tests / nginx-moreheaders.nix
blob34bbb211dc9d340c19099d9d57e0c290e6dfdd8c
1 import ./make-test-python.nix {
2   name = "nginx-more-headers";
4   nodes = {
5     webserver =
6       { pkgs, ... }:
7       {
8         services.nginx = {
9           enable = true;
11           virtualHosts.test = {
12             locations = {
13               "/".return = "200 blub";
14               "/some" = {
15                 return = "200 blub";
16                 extraConfig = ''
17                   more_set_headers "Referrer-Policy: no-referrer";
18                 '';
19               };
20             };
21             extraConfig = ''
22               more_set_headers "X-Powered-By: nixos";
23             '';
24           };
25         };
26       };
27   };
29   testScript = ''
30     webserver.wait_for_unit("nginx")
31     webserver.wait_for_open_port(80)
33     webserver.succeed("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test | grep -q \"X-Powered-By: nixos\"")
34     webserver.fail("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test | grep -q \"Referrer-Policy: no-referrer\"")
36     webserver.succeed("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test/some | grep -q \"X-Powered-By: nixos\"")
37     webserver.succeed("curl --fail --resolve test:80:127.0.0.1 --head --verbose http://test/some | grep -q \"Referrer-Policy: no-referrer\"")
38   '';