Skip to content

Commit

Permalink
Support SPA requests by routing 404 to /index.html (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHendrickson authored Dec 12, 2023
1 parent 0fdfb6a commit b80111b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions terraform/web.tf
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,8 @@ module "cdn" {
custom_error_response = [
{
error_code = 404
response_code = 404
response_page_path = "/errors/404.html"
},
{
error_code = 403
response_code = 403
response_page_path = "/errors/403.html"
response_code = 200
response_page_path = "/index.html"
},
]

Expand Down Expand Up @@ -264,6 +259,9 @@ module "cdn" {
compress = true
cache_policy_id = data.aws_cloudfront_cache_policy.Managed-CachingOptimized.id
use_forwarded_values = false

// See https://github.com/aws-samples/amazon-cloudfront-functions/tree/main/url-rewrite-single-page-apps
function_association = {}
}

ordered_cache_behavior = [
Expand Down

0 comments on commit b80111b

Please sign in to comment.