From 0ab5c760ac1b5f4981081038fad835d8c0a7acf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahlstr=C3=B6m=20Kalle?= Date: Tue, 23 Jan 2024 03:28:05 +0200 Subject: [PATCH] add access-control-allow-origin to CDN --- modules/web/app/main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/web/app/main.tf b/modules/web/app/main.tf index 20810a1..100f187 100644 --- a/modules/web/app/main.tf +++ b/modules/web/app/main.tf @@ -126,7 +126,7 @@ resource "azurerm_cdn_endpoint" "next-cdn-endpoint" { querystring_caching_behaviour = "BypassCaching" origin { name = "tikweb-web-${terraform.workspace}" - host_name = azurerm_linux_web_app.web.default_hostname + host_name = local.fqdn } origin_host_header = local.fqdn @@ -146,6 +146,11 @@ resource "azurerm_cdn_endpoint" "next-cdn-endpoint" { "/_next/static/" ] } + modify_response_header_action { + action = "Overwrite" + name = "Access-Control-Allow-Origin" + value = "https://${local.fqdn}" + } cache_expiration_action { behavior = "Override" duration = "10.00:00:00"