Skip to content

Commit

Permalink
fix: set caching headers for assetlinks.json (#9270)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet authored Nov 9, 2023
1 parent c42b62f commit 12dd063
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
8 changes: 8 additions & 0 deletions conf/nginx/sites-available/obf
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ server {
try_files $uri $uri/ =404;
}

# GoogleAssociationService made 2500 requests/min to assetlinks.json
# and much less when caching headers are sent
location = /.well-known/assetlinks.json {
include snippets/off.cors-headers.include;
expires 1d;
try_files $uri $uri/ =404;
}

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
Expand Down
8 changes: 8 additions & 0 deletions conf/nginx/sites-available/off
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ server {
gunzip on;
}

# GoogleAssociationService made 2500 requests/min to assetlinks.json
# and much less when caching headers are sent
location = /.well-known/assetlinks.json {
include snippets/off.cors-headers.include;
expires 1d;
try_files $uri $uri/ =404;
}

include snippets/off.locations-redirects.include;

# Dynamically generated files and CGI scripts are passed
Expand Down
9 changes: 8 additions & 1 deletion conf/nginx/sites-available/opf
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,21 @@ server {
try_files $uri $uri/ =404;
}


location ~ ^/(.well-known|images|fonts|css|js|rss|files|resources|foundation|bower_components)/ {
include snippets/off.cors-headers.include;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

# GoogleAssociationService made 2500 requests/min to assetlinks.json
# and much less when caching headers are sent
location = /.well-known/assetlinks.json {
include snippets/off.cors-headers.include;
expires 1d;
try_files $uri $uri/ =404;
}

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
Expand Down
8 changes: 8 additions & 0 deletions conf/nginx/sites-available/opff
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ server {
try_files $uri $uri/ =404;
}

# GoogleAssociationService made 2500 requests/min to assetlinks.json
# and much less when caching headers are sent
location = /.well-known/assetlinks.json {
include snippets/off.cors-headers.include;
expires 1d;
try_files $uri $uri/ =404;
}

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
Expand Down

0 comments on commit 12dd063

Please sign in to comment.