File tree Expand file tree Collapse file tree 7 files changed +22
-4
lines changed Expand file tree Collapse file tree 7 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ resource "aws_cloudfront_distribution" "site" {
3434 }
3535 }
3636
37+ dynamic "custom_error_response" {
38+ for_each = var. enable_spa_error_handling ? toset ([" 403" , " 404" ]) : []
39+ content {
40+ error_code = each. value
41+ response_code = 200
42+ response_page_path = format (" /%s" , coalesce (var. default_root_object , " index.html" ))
43+ }
44+ }
45+
3746 restrictions {
3847 geo_restriction {
3948 restriction_type = " none"
Original file line number Diff line number Diff line change 11resource "aws_route53_record" "alias" {
2- for_each = toset (flatten ([[module . label_site . dns_name ], var . extra_domain_prefixes ]))
2+ for_each = toset (flatten ([[local . default_alias ], var . extra_domain_prefixes ]))
33 name = each. key
44 type = " A"
55 zone_id = var. domain_zone_id
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ terraform {
33 required_providers {
44 aws = {
55 source = " hashicorp/aws"
6- version = " ~> 5 .0"
6+ version = " ~> 6 .0"
77 }
88 }
99}
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ require (
103103 github.com/spf13/pflag v1.0.6 // indirect
104104 github.com/stretchr/testify v1.10.0 // indirect
105105 github.com/tmccombs/hcl2json v0.6.7 // indirect
106- github.com/ulikunitz/xz v0.5.12 // indirect
106+ github.com/ulikunitz/xz v0.5.15 // indirect
107107 github.com/urfave/cli/v2 v2.27.6 // indirect
108108 github.com/x448/float16 v0.8.4 // indirect
109109 github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
Original file line number Diff line number Diff line change @@ -218,6 +218,8 @@ github.com/tmccombs/hcl2json v0.6.7 h1:RYKTs4kd/gzRsEiv7J3M2WQ7TYRYZVc+0H0pZdERk
218218github.com/tmccombs/hcl2json v0.6.7 /go.mod h1:lJgBOOGDpbhjvdG2dLaWsqB4KBzul2HytfDTS3H465o =
219219github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc =
220220github.com/ulikunitz/xz v0.5.12 /go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14 =
221+ github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY =
222+ github.com/ulikunitz/xz v0.5.15 /go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14 =
221223github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g =
222224github.com/urfave/cli/v2 v2.27.6 /go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ =
223225github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM =
Original file line number Diff line number Diff line change @@ -65,3 +65,10 @@ variable "function_associations" {
6565 description = " A config block that triggers a lambda function with specific actions (maximum 4)."
6666 nullable = false
6767}
68+
69+ variable "enable_spa_error_handling" {
70+ type = bool
71+ default = false
72+ description = " Enable SPA error handling by redirecting 403 errors to / with 200 status code."
73+ nullable = false
74+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ terraform {
33 required_providers {
44 aws = {
55 source = " hashicorp/aws"
6- version = " ~> 5 .0"
6+ version = " ~> 6 .0"
77 configuration_aliases = [aws.route53]
88 }
99 }
You can’t perform that action at this time.
0 commit comments