Unverified Commit a3c953a3 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #201867 from vincentbernat/fix/nginx-global-redirect-exceptions

parents be779165 fc39b5ec
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -268,6 +268,14 @@
          dynamically.
        </para>
      </listitem>
      <listitem>
        <para>
          Enabling global redirect in
          <literal>services.nginx.virtualHosts</literal> now allows one
          to add exceptions with the <literal>locations</literal>
          option.
        </para>
      </listitem>
      <listitem>
        <para>
          Resilio sync secret keys can now be provided using a secrets
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- The new option `users.motdFile` allows configuring a Message Of The Day that can be updated dynamically.

- Enabling global redirect in `services.nginx.virtualHosts` now allows one to add exceptions with the `locations` option.

- Resilio sync secret keys can now be provided using a secrets file at runtime, preventing these secrets from ending up in the Nix store.

- The `services.fwupd` module now allows arbitrary daemon settings to be configured in a structured manner ([`services.fwupd.daemonSettings`](#opt-services.fwupd.daemonSettings)).
+3 −1
Original line number Diff line number Diff line
@@ -318,7 +318,9 @@ let
          ${acmeLocation}
          ${optionalString (vhost.root != null) "root ${vhost.root};"}
          ${optionalString (vhost.globalRedirect != null) ''
            location / {
              return 301 http${optionalString hasSSL "s"}://${vhost.globalRedirect}$request_uri;
            }
          ''}
          ${optionalString hasSSL ''
            ssl_certificate ${vhost.sslCertificate};
+1 −0
Original line number Diff line number Diff line
@@ -435,6 +435,7 @@ in {
  nginx = handleTest ./nginx.nix {};
  nginx-auth = handleTest ./nginx-auth.nix {};
  nginx-etag = handleTest ./nginx-etag.nix {};
  nginx-globalredirect = handleTest ./nginx-globalredirect.nix {};
  nginx-http3 = handleTest ./nginx-http3.nix {};
  nginx-modsecurity = handleTest ./nginx-modsecurity.nix {};
  nginx-njs = handleTest ./nginx-njs.nix {};
+24 −0
Original line number Diff line number Diff line
import ./make-test-python.nix ({ pkgs, ... }: {
  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'";
        };
      };
    };
  };

  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:'")
  '';
})
Loading