Skip to content

Commit 8886ccf

Browse files
authored
feat: add immich.ca domain to cloudflare (#1678)
1 parent 4fa29c0 commit 8886ccf

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "cloudflare_record" "immich_ca_aaaa_root" {
2+
name = "immich.ca"
3+
proxied = true
4+
ttl = 1
5+
type = "AAAA"
6+
content = "100::"
7+
zone_id = cloudflare_zone.immich_ca.id
8+
}
9+
10+
resource "cloudflare_record" "immich_ca_aaaa_www" {
11+
name = "www"
12+
proxied = true
13+
ttl = 1
14+
type = "AAAA"
15+
content = "100::"
16+
zone_id = cloudflare_zone.immich_ca.id
17+
}

tf/deployment/modules/shared/cloudflare/account/redirects.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,27 @@ resource "cloudflare_ruleset" "immich_cc_redirects" {
173173
enabled = true
174174
}
175175
}
176+
177+
resource "cloudflare_ruleset" "immich_ca_redirects" {
178+
zone_id = cloudflare_zone.immich_ca.id
179+
name = "immich.ca to immich.app redirects"
180+
description = "Redirects immich.ca to immich.app"
181+
kind = "zone"
182+
phase = "http_request_dynamic_redirect"
183+
184+
rules {
185+
action = "redirect"
186+
action_parameters {
187+
from_value {
188+
status_code = 307
189+
target_url {
190+
value = "https://immich.app"
191+
}
192+
preserve_query_string = true
193+
}
194+
}
195+
expression = "(http.host eq \"www.immich.ca\") or (http.host eq \"immich.ca\")"
196+
description = "Redirect visitors going to immich.ca links"
197+
enabled = true
198+
}
199+
}

tf/deployment/modules/shared/cloudflare/account/zones.tf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,38 @@ output "immich_pro_zone_id" {
157157
value = cloudflare_zone.immich_pro.id
158158
}
159159

160+
resource "cloudflare_zone" "immich_ca" {
161+
account_id = var.cloudflare_account_id
162+
zone = "immich.ca"
163+
}
164+
165+
resource "cloudflare_zone_settings_override" "immich_ca" {
166+
zone_id = cloudflare_zone.immich_ca.id
167+
168+
settings {
169+
http3 = "on"
170+
zero_rtt = "on"
171+
tls_1_3 = "zrt"
172+
always_use_https = "on"
173+
ssl = "strict"
174+
brotli = "on"
175+
fonts = "on"
176+
early_hints = "on"
177+
rocket_loader = "on"
178+
speed_brain = "on"
179+
}
180+
}
181+
182+
resource "cloudflare_tiered_cache" "immich_ca" {
183+
zone_id = cloudflare_zone.immich_ca.id
184+
cache_type = "smart"
185+
}
186+
187+
188+
output "immich_ca_zone_id" {
189+
value = cloudflare_zone.immich_ca.id
190+
}
191+
160192
resource "cloudflare_zone" "immich_build" {
161193
account_id = var.cloudflare_account_id
162194
zone = "immich.build"

0 commit comments

Comments
 (0)