mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +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-etag = runTest ./nginx-etag.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-mime = handleTest ./nginx-mime.nix {};
|
||||
nginx-modsecurity = handleTest ./nginx-modsecurity.nix {};
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
import ./make-test-python.nix (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
name = "nginx-globalredirect";
|
||||
{ ... }:
|
||||
{
|
||||
name = "nginx-globalredirect";
|
||||
|
||||
nodes = {
|
||||
webserver =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.localhost = {
|
||||
globalRedirect = "other.example.com";
|
||||
# Add an exception
|
||||
locations."/noredirect".return = "200 'foo'";
|
||||
};
|
||||
nodes = {
|
||||
webserver =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.localhost = {
|
||||
globalRedirect = "other.example.com";
|
||||
# Add an exception
|
||||
locations."/noredirect".return = "200 'foo'";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
webserver.wait_for_unit("nginx")
|
||||
webserver.wait_for_open_port(80)
|
||||
testScript = ''
|
||||
webserver.wait_for_unit("nginx")
|
||||
webserver.wait_for_open_port(80)
|
||||
|
||||
webserver.succeed("curl --fail -si http://localhost/alf | grep '^Location:.*/alf'")
|
||||
webserver.fail("curl --fail -si http://localhost/noredirect | grep '^Location:'")
|
||||
'';
|
||||
}
|
||||
)
|
||||
webserver.succeed("curl --fail -si http://localhost/alf | grep '^Location:.*/alf'")
|
||||
webserver.fail("curl --fail -si http://localhost/noredirect | grep '^Location:'")
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue