Skip to content

Commit

Permalink
Update cloudfront.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
kjlippold authored Feb 27, 2024
1 parent 0a53f12 commit 7962a00
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions terraform/aws/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ resource "aws_cloudfront_distribution" "hydroserver_distribution" {
origin_id = "hydroserver-web"
}

origin {
domain_name = aws_s3_bucket.hydroserver_static_bucket.bucket_regional_domain_name
origin_access_control_id = aws_cloudfront_origin_access_control.hydroserver_oac.id
origin_id = "hydroserver-static"
}

origin {
domain_name = aws_s3_bucket.hydroserver_storage_bucket.bucket_regional_domain_name
origin_access_control_id = aws_cloudfront_origin_access_control.hydroserver_oac.id
Expand Down Expand Up @@ -98,10 +92,41 @@ resource "aws_cloudfront_distribution" "hydroserver_distribution" {
}
}

ordered_cache_behavior {
path_pattern = "/media/*"
target_origin_id = "hydroserver-storage"
viewer_protocol_policy = "redirect-to-https"

allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]

forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
}

ordered_cache_behavior {
path_pattern = "/static/*"
target_origin_id = "hydroserver-storage"
viewer_protocol_policy = "redirect-to-https"

allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]

forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
}

restrictions {
geo_restriction {
restriction_type = "whitelist"
locations = ["US", "CA"]
restriction_type = "none"
}
}

Expand Down

0 comments on commit 7962a00

Please sign in to comment.