diff --git a/88-tar1090.conf b/88-tar1090.conf index 7c4919b..63ebd76 100644 --- a/88-tar1090.conf +++ b/88-tar1090.conf @@ -11,6 +11,13 @@ url.redirect += ( "^/INSTANCE$" => "/INSTANCE/" ) +$HTTP["url"] =~ "^/INSTANCE/traces/" { + setenv.add-response-header += ( + "Cache-Control" => "public, max-age=10", + "Content-Encoding" => "gzip", + "Content-Type" => "application/json", + ) +} $HTTP["url"] =~ "^/INSTANCE/chunks/chunk_.*gz$" { setenv.add-response-header += ( "Access-Control-Allow-Origin" => "*", diff --git a/html/script.js b/html/script.js index 934733b..2bf1f6c 100644 --- a/html/script.js +++ b/html/script.js @@ -2091,8 +2091,8 @@ function selectPlaneByHex(hex, options) { if (!options.noFetch && globeIndex && hex) { - var URL1 = 'data/traces/'+ hex.slice(-2) + '/trace_recent_' + hex + '.json'; - var URL2 = 'data/traces/'+ hex.slice(-2) + '/trace_full_' + hex + '.json'; + var URL1 = 'data/traces/'+ hex.slice(-2) + '/trace_recent_' + hex + '.json.gz'; + var URL2 = 'data/traces/'+ hex.slice(-2) + '/trace_full_' + hex + '.json.gz'; //console.log('Requesting trace: ' + hex); var req1 = $.ajax({ url: URL1, diff --git a/nginx.conf b/nginx.conf index c12d125..30f7d2b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -4,8 +4,10 @@ location /INSTANCE/data/ { location ~ aircraft\.json$ { add_header Cache-Control "public, max-age=0"; } - location ~ trace_.*\.json$ { + location /INSTANCE/data/traces/ { add_header Cache-Control "public, max-age=10"; + add_header Content-Type "application/json"; + add_header Content-Encoding "gzip"; } location ~ globe_.*\.json$ { add_header Cache-Control "public, max-age=2"; diff --git a/nginx_webroot.conf b/nginx_webroot.conf index 22d57ce..95deb51 100644 --- a/nginx_webroot.conf +++ b/nginx_webroot.conf @@ -4,8 +4,10 @@ location /data/ { location ~ aircraft\.json$ { add_header Cache-Control "public, max-age=0"; } - location ~ trace_.*\.json$ { + location /data/traces/ { add_header Cache-Control "public, max-age=10"; + add_header Content-Type "application/json"; + add_header Content-Encoding "gzip"; } location ~ globe_.*\.json$ { add_header Cache-Control "public, max-age=2";