@@ -116,9 +116,16 @@ server {
116116 log_not_found off;
117117 }
118118
119- location = /favicon.ico {
119+ location = /site.webmanifest {
120120 log_not_found off;
121121 access_log off;
122+ expires ${NGINX_STATIC_FILES_LIFETIME} ;
123+ }
124+
125+ location ~ ^/(android-chrome-.+|apple-touch-icon|favicon.*|mstile-.+|safari-pinned-tab).(png|svg|jpg|ico)$ {
126+ log_not_found off;
127+ access_log off;
128+ expires ${NGINX_STATIC_FILES_LIFETIME} ;
122129 }
123130
124131EOM
184191 # pass persistent resource requests to GCS
185192 location ~* "^${BEACH_PERSISTENT_RESOURCES_BASE_PATH} ([a-f0-9]{40})/" {
186193 resolver 8.8.8.8;
187- expires 3600 ;
194+ expires ${NGINX_STATIC_FILES_LIFETIME} ;
188195 proxy_set_header Authorization "";
189196 add_header Via 'Beach Asset Proxy';
190197 ${addHeaderStrictTransportSecurity}
193200EOM
194201 elif [ -n " ${BEACH_PERSISTENT_RESOURCES_FALLBACK_BASE_URI} " ]; then
195202 cat >> " ${NGINX_CONF_PATH} /sites-enabled/site.conf" << -EOM
196- location ~* ^/_Resources/Persistent/ (.*)$ {
203+ location ~* "^ ${BEACH_PERSISTENT_RESOURCES_BASE_PATH} (.*)$ {
197204 access_log off;
198- expires 3600 ;
205+ expires ${NGINX_STATIC_FILES_LIFETIME} ;
199206 add_header Via '\$ hostname' always;
200207 ${addHeaderStrictTransportSecurity}
201208 try_files \$ uri @fallback;
209216 proxy_pass \$ assetUri;
210217 }
211218EOM
212-
219+ else
220+ cat >> " ${NGINX_CONF_PATH} /sites-enabled/site.conf" << -EOM
221+ location ~* ^/_Resources/Persistent/(.*)$ {
222+ access_log off;
223+ expires ${NGINX_STATIC_FILES_LIFETIME} ;
224+ add_header Via '\$ hostname' always;
225+ ${addHeaderStrictTransportSecurity}
226+ try_files \$ uri -404;
227+ }
228+ EOM
213229 fi
214230
215231 cat >> " ${NGINX_CONF_PATH} /sites-enabled/site.conf" << -EOM
221237
222238 # for all static resources
223239 location ~ ^/_Resources/Static/ {
224- add_header Via '\$ hostname' always;
240+ add_header X-Static-Resource '\$ hostname' always;
225241 access_log off;
226- expires 3600 ;
242+ expires ${NGINX_STATIC_FILES_LIFETIME} ;
227243 }
228244}
229245EOM
0 commit comments