From 916f1786f9787c76e10b554a2c0f0ed98b41f2a3 Mon Sep 17 00:00:00 2001 From: mynampatinaveen Date: Wed, 4 Sep 2024 12:36:57 +0100 Subject: [PATCH] CCL-497 added 404 custom_error_response (#167) --- modules/products/static-site/cloudfront.tf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/products/static-site/cloudfront.tf b/modules/products/static-site/cloudfront.tf index 579e2b0..9f44c53 100644 --- a/modules/products/static-site/cloudfront.tf +++ b/modules/products/static-site/cloudfront.tf @@ -48,6 +48,14 @@ resource "aws_cloudfront_distribution" "static_site_distribution" { event_type = "viewer-request" function_arn = aws_cloudfront_function.rewritedefaultindexrequest.arn } + + custom_error_response { + error_code = 404 + response_page_path = "/404.html" # Path to your custom error page + response_code = 404 + error_caching_min_ttl = 10 # Cache TTL in seconds + } + } restrictions {