mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00
parent
8638fa379f
commit
69df9598cb
2 changed files with 23 additions and 25 deletions
|
@ -801,7 +801,7 @@ in {
|
||||||
nginx-auth = runTest ./nginx-auth.nix;
|
nginx-auth = runTest ./nginx-auth.nix;
|
||||||
nginx-etag = runTest ./nginx-etag.nix;
|
nginx-etag = runTest ./nginx-etag.nix;
|
||||||
nginx-etag-compression = runTest ./nginx-etag-compression.nix;
|
nginx-etag-compression = runTest ./nginx-etag-compression.nix;
|
||||||
nginx-globalredirect = handleTest ./nginx-globalredirect.nix {};
|
nginx-globalredirect = runTest ./nginx-globalredirect.nix;
|
||||||
nginx-http3 = handleTest ./nginx-http3.nix {};
|
nginx-http3 = handleTest ./nginx-http3.nix {};
|
||||||
nginx-mime = handleTest ./nginx-mime.nix {};
|
nginx-mime = handleTest ./nginx-mime.nix {};
|
||||||
nginx-modsecurity = handleTest ./nginx-modsecurity.nix {};
|
nginx-modsecurity = handleTest ./nginx-modsecurity.nix {};
|
||||||
|
|
|
@ -1,29 +1,27 @@
|
||||||
import ./make-test-python.nix (
|
{ ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
name = "nginx-globalredirect";
|
||||||
name = "nginx-globalredirect";
|
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
webserver =
|
webserver =
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts.localhost = {
|
virtualHosts.localhost = {
|
||||||
globalRedirect = "other.example.com";
|
globalRedirect = "other.example.com";
|
||||||
# Add an exception
|
# Add an exception
|
||||||
locations."/noredirect".return = "200 'foo'";
|
locations."/noredirect".return = "200 'foo'";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
webserver.wait_for_unit("nginx")
|
webserver.wait_for_unit("nginx")
|
||||||
webserver.wait_for_open_port(80)
|
webserver.wait_for_open_port(80)
|
||||||
|
|
||||||
webserver.succeed("curl --fail -si http://localhost/alf | grep '^Location:.*/alf'")
|
webserver.succeed("curl --fail -si http://localhost/alf | grep '^Location:.*/alf'")
|
||||||
webserver.fail("curl --fail -si http://localhost/noredirect | grep '^Location:'")
|
webserver.fail("curl --fail -si http://localhost/noredirect | grep '^Location:'")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue