cache control improvements
This commit is contained in:
@@ -22,21 +22,31 @@ $HTTP["url"] =~ "^/INSTANCE/chunks/chunk_.*gz$" {
|
||||
$HTTP["url"] =~ "^/INSTANCE/chunks/current_.*gz$" {
|
||||
setenv.add-response-header += (
|
||||
"Access-Control-Allow-Origin" => "*",
|
||||
"Cache-Control" => "must-revalidate",
|
||||
"Cache-Control" => "public, max-age=0",
|
||||
"Content-Encoding" => "gzip",
|
||||
"Content-Type" => "application/json",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/chunks/978\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, max-age=0",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/data/aircraft\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, max-age=0",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/data/globe_.*\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, max-age=0",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/data/icao_.*\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, max-age=10",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/data/globe_.*\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, must-revalidate",
|
||||
)
|
||||
}
|
||||
$HTTP["url"] =~ "^/INSTANCE/db/.*\.json$" {
|
||||
setenv.add-response-header += (
|
||||
"Cache-Control" => "public, max-age=1209600",
|
||||
@@ -67,8 +77,3 @@ $HTTP["url"] =~ "^/INSTANCE/.*\.css$" {
|
||||
"Cache-Control" => "public, max-age=1209600",
|
||||
)
|
||||
}
|
||||
|
||||
# Add CORS header
|
||||
$HTTP["url"] =~ "^/INSTANCE/data/.*\.json$" {
|
||||
setenv.add-response-header += ( "Access-Control-Allow-Origin" => "*" )
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ function PlaneObject(icao) {
|
||||
features: this.trail_features,
|
||||
}),
|
||||
renderOrder: null,
|
||||
declutter: true,
|
||||
//declutter: true,
|
||||
});
|
||||
|
||||
trailGroup.push(this.layer);
|
||||
@@ -779,7 +779,6 @@ PlaneObject.prototype.processTrace = function(data) {
|
||||
|
||||
this.updateTrack(_now, _last);
|
||||
_last = _now;
|
||||
//console.log(this.position);
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.trace.length; i++) {
|
||||
@@ -814,6 +813,7 @@ PlaneObject.prototype.processTrace = function(data) {
|
||||
}
|
||||
|
||||
|
||||
console.log(this.history_size);
|
||||
this.remakeTrail();
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,6 @@ function fetchData() {
|
||||
if (enable_uat) {
|
||||
FetchPendingUAT = $.ajax({ url: 'chunks/978.json',
|
||||
timeout: 7000,
|
||||
cache: false,
|
||||
dataType: 'json' });
|
||||
|
||||
FetchPendingUAT.done(function(data) {
|
||||
@@ -357,7 +356,6 @@ function fetchData() {
|
||||
//console.log(ac_url[i]);
|
||||
var req = $.ajax({ url: ac_url[i],
|
||||
timeout: 8000,
|
||||
cache: globeIndex,
|
||||
dataType: 'json' });
|
||||
FetchPending.push(req);
|
||||
|
||||
@@ -2823,7 +2821,6 @@ function fetchPfData() {
|
||||
for (const i in pf_data) {
|
||||
const req = $.ajax({ url: pf_data[i],
|
||||
timeout: 20000,
|
||||
cache: false,
|
||||
dataType: 'json' });
|
||||
$.when(req).done(function(data) {
|
||||
for (const i in PlanesOrdered) {
|
||||
|
||||
@@ -264,6 +264,13 @@ if [[ $nginx == yes ]]; then
|
||||
for service in $services; do
|
||||
echo "include /usr/local/share/tar1090/nginx-$service.conf;"
|
||||
done
|
||||
if [[ "$1" == "test" ]]
|
||||
then
|
||||
if [ -d /run/readsb ]; then
|
||||
sed -i -e 's/dump1090-fa/readsb/g' /usr/local/share/tar1090/nginx_webroot.conf
|
||||
fi
|
||||
systemctl restart nginx
|
||||
fi
|
||||
fi
|
||||
|
||||
echo --------------
|
||||
@@ -279,3 +286,4 @@ elif [[ $nginx == yes ]]; then
|
||||
else
|
||||
echo "All done! You'll need to configure your webserver yourself, see /usr/local/share/tar1090/nginx-tar1090.conf for a reference nginx configuration"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
# nginx configuration for tar1090
|
||||
location /INSTANCE/data/ {
|
||||
alias SOURCE_DIR/;
|
||||
location ~ aircraft\.json$ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
location ~ icao_.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=10";
|
||||
}
|
||||
location ~ globe_.*\.json$ {
|
||||
add_header Cache-Control "public, must-revalidate";
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +24,9 @@ location /INSTANCE/chunks/ {
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
location ~ .*\.json$ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
}
|
||||
|
||||
location /INSTANCE {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# nginx configuration for tar1090 for access via /
|
||||
location /data/ {
|
||||
alias /run/dump1090-fa/;
|
||||
location ~ aircraft\.json$ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
location ~ icao_.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=10";
|
||||
}
|
||||
location ~ globe_.*\.json$ {
|
||||
add_header Cache-Control "public, must-revalidate";
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +24,9 @@ location /chunks/ {
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
location ~ .*\.json$ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
|
||||
Reference in New Issue
Block a user