summaryrefslogtreecommitdiff
path: root/terranix/cloudflare/ruleset.nix
blob: 98364d9d4f4ad8907b7ee2bfb8facee62b984ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ lib, ... }:
{
  resource.cloudflare_ruleset = {
    getchoo_com_redirects = {
      kind = "zone";
      name = "default";
      phase = "http_request_dynamic_redirect";
      zone_id = lib.tfRef "var.getchoo_com_zone_id";

      rules = [
        {
          action = "redirect";
          action_parameters = {
            from_value = {
              preserve_query_string = false;
              status_code = 301;
              target_url = {
                value = "https://www.youtube.com/watch?v=RvVdFXOFcjw";
              };
            };
          };
          description = "funny";
          enabled = true;
          expression = "(http.request.uri.path eq \"/hacks\" and http.host eq \"getchoo.com\")";
        }
      ];
    };
  };
}