mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2024-12-18 20:57:56 +00:00
add cache control for index page (#150)
Co-authored-by: xssfox <xss@sprocketfox.io>
This commit is contained in:
parent
ffd606d60c
commit
b107f54d86
58
cdn.tf
58
cdn.tf
@ -364,6 +364,52 @@ resource "aws_cloudfront_distribution" "sondehub" {
|
||||
target_origin_id = "S3-${local.domain_name}"
|
||||
viewer_protocol_policy = "redirect-to-https"
|
||||
}
|
||||
ordered_cache_behavior {
|
||||
path_pattern = "index.html"
|
||||
allowed_methods = ["GET", "HEAD", "OPTIONS"]
|
||||
cached_methods = [
|
||||
"HEAD",
|
||||
"GET"
|
||||
]
|
||||
response_headers_policy_id = aws_cloudfront_response_headers_policy.no_cache.id
|
||||
compress = true
|
||||
forwarded_values {
|
||||
cookies {
|
||||
forward = "none"
|
||||
}
|
||||
query_string = false
|
||||
}
|
||||
|
||||
max_ttl = 0
|
||||
min_ttl = 0
|
||||
default_ttl = 0
|
||||
smooth_streaming = false
|
||||
target_origin_id = "S3-${local.domain_name}"
|
||||
viewer_protocol_policy = "redirect-to-https"
|
||||
}
|
||||
ordered_cache_behavior {
|
||||
path_pattern = "/"
|
||||
allowed_methods = ["GET", "HEAD", "OPTIONS"]
|
||||
cached_methods = [
|
||||
"HEAD",
|
||||
"GET"
|
||||
]
|
||||
response_headers_policy_id = aws_cloudfront_response_headers_policy.no_cache.id
|
||||
compress = true
|
||||
forwarded_values {
|
||||
cookies {
|
||||
forward = "none"
|
||||
}
|
||||
query_string = false
|
||||
}
|
||||
|
||||
max_ttl = 0
|
||||
min_ttl = 0
|
||||
default_ttl = 0
|
||||
smooth_streaming = false
|
||||
target_origin_id = "S3-${local.domain_name}"
|
||||
viewer_protocol_policy = "redirect-to-https"
|
||||
}
|
||||
|
||||
ordered_cache_behavior {
|
||||
|
||||
@ -599,6 +645,18 @@ resource "aws_cloudfront_distribution" "amateur" {
|
||||
is_ipv6_enabled = true
|
||||
}
|
||||
|
||||
resource "aws_cloudfront_response_headers_policy" "no_cache" {
|
||||
name = "nocache"
|
||||
|
||||
custom_headers_config {
|
||||
items {
|
||||
header = "cache-control"
|
||||
override = true
|
||||
value = "no-cache"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_cloudfront_distribution" "amateur_testing" {
|
||||
aliases = [
|
||||
"amateur-testing.sondehub.org"
|
||||
|
@ -34,4 +34,10 @@ def handler(event, context):
|
||||
uri = re.sub(r"^\/","", uri)
|
||||
sonde = re.sub(r'^(DFM|M10|M20|IMET|IMET54|MRZ|LMS6)-',"", uri)
|
||||
return redirect('https://sondehub.org/?sondehub=1#!f=' + sonde + '&mz=9&qm=All&q=' + sonde)
|
||||
request['headers']['cache-control'] = [
|
||||
{
|
||||
"key": "Cache-Control",
|
||||
"value": "no-cache"
|
||||
}
|
||||
]
|
||||
return request
|
Loading…
Reference in New Issue
Block a user