Only send caching headers for existing objects (response code equals 200, 201, 204, 206, 301, 302, 303, 304, 307 or 308)
This commit is contained in:
@@ -23,48 +23,48 @@ const nginxTemplate = `server {
|
|||||||
location = / {
|
location = / {
|
||||||
try_files /index.html =404;
|
try_files /index.html =404;
|
||||||
|
|
||||||
add_header Content-Type "text/html; charset=utf-8" always;
|
add_header Content-Type "text/html; charset=utf-8";
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
add_header Access-Control-Allow-Origin "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checkpoint endpoint - no caching
|
# Checkpoint endpoint - no caching
|
||||||
location = /checkpoint {
|
location = /checkpoint {
|
||||||
try_files /checkpoint =404;
|
try_files /checkpoint =404;
|
||||||
|
|
||||||
add_header Content-Type "text/plain; charset=utf-8" always;
|
add_header Content-Type "text/plain; charset=utf-8";
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
add_header Access-Control-Allow-Origin "*";
|
||||||
add_header Cache-Control "no-store" always;
|
add_header Cache-Control "no-store";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log info endpoint
|
# Log info endpoint
|
||||||
location = /log.v3.json {
|
location = /log.v3.json {
|
||||||
try_files /log.v3.json =404;
|
try_files /log.v3.json =404;
|
||||||
|
|
||||||
add_header Content-Type "application/json" always;
|
add_header Content-Type "application/json";
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
add_header Access-Control-Allow-Origin "*";
|
||||||
add_header Cache-Control "public, max-age=3600, immutable" always;
|
add_header Cache-Control "public, max-age=3600, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Issuer certificate endpoint - long cache
|
# Issuer certificate endpoint - long cache
|
||||||
location ~ ^/issuer/(.+)$ {
|
location ~ ^/issuer/(.+)$ {
|
||||||
try_files /issuer/$1 =404;
|
try_files /issuer/$1 =404;
|
||||||
|
|
||||||
add_header Content-Type "application/pkix-cert" always;
|
add_header Content-Type "application/pkix-cert";
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
add_header Access-Control-Allow-Origin "*";
|
||||||
add_header Cache-Control "public, max-age=604800, immutable" always;
|
add_header Cache-Control "public, max-age=604800, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tile data endpoint - long cache, may have gzip
|
# Tile data endpoint - long cache, may have gzip
|
||||||
location ~ ^/tile/(.+)$ {
|
location ~ ^/tile/(.+)$ {
|
||||||
try_files /tile/$1 =404;
|
try_files /tile/$1 =404;
|
||||||
|
|
||||||
add_header Content-Type "application/octet-stream" always;
|
add_header Content-Type "application/octet-stream";
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
add_header Access-Control-Allow-Origin "*";
|
||||||
add_header Cache-Control "public, max-age=604800, immutable" always;
|
add_header Cache-Control "public, max-age=604800, immutable";
|
||||||
|
|
||||||
# Gzip encoding for .gz files
|
# Gzip encoding for .gz files
|
||||||
location ~ \.gz$ {
|
location ~ \.gz$ {
|
||||||
add_header Content-Encoding "gzip" always;
|
add_header Content-Encoding "gzip";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user