Update production nginx.conf resource cache times
This commit is contained in:
		
							parent
							
								
									2ad538fb8a
								
							
						
					
					
						commit
						25400c0241
					
				@ -46,6 +46,7 @@ add_header Vary Cookie;
 | 
			
		||||
# https://stackoverflow.com/questions/5238377/nginx-location-priority
 | 
			
		||||
 | 
			
		||||
# for exact / requests, redirect based on $lang
 | 
			
		||||
# cache redirect for 10 minutes
 | 
			
		||||
location = / {
 | 
			
		||||
	if ($lang != '') {
 | 
			
		||||
		return 302 $scheme://$host/$lang$uri;
 | 
			
		||||
@ -55,11 +56,17 @@ location = / {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# used to rewrite resources from /<lang>/ to /en-US/
 | 
			
		||||
# cache /resources/** for 1 week since they don't change often
 | 
			
		||||
location ~ ^/[a-z][a-z]/resources/(.*) {
 | 
			
		||||
	try_files $uri /en-US/resources/$1 =404;
 | 
			
		||||
        expires 1w;
 | 
			
		||||
}
 | 
			
		||||
# used for cookie override
 | 
			
		||||
# cache /<lang>/main.f40e91d908a068a2.js forever since they never change
 | 
			
		||||
location ~ ^/([a-z][a-z])/(.+\..+\.(js|css)) {
 | 
			
		||||
	try_files $uri =404;
 | 
			
		||||
	expires 1y;
 | 
			
		||||
}
 | 
			
		||||
# cache everything else for 10 minutes
 | 
			
		||||
location ~ ^/([a-z][a-z])$ {
 | 
			
		||||
	try_files $uri /$1/index.html /en-US/index.html =404;
 | 
			
		||||
        expires 10m;
 | 
			
		||||
@ -69,12 +76,18 @@ location ~ ^/([a-z][a-z])/ {
 | 
			
		||||
        expires 10m;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# fallback to serving resources from en-US
 | 
			
		||||
# cache /resources/** for 1 week since they don't change often
 | 
			
		||||
location /resources {
 | 
			
		||||
	try_files $uri /en-US/$uri /en-US/index.html;
 | 
			
		||||
	expires 1w;
 | 
			
		||||
}
 | 
			
		||||
# fallback for all URLs i.e. /address/foo /tx/foo /block/000
 | 
			
		||||
# cache /main.f40e91d908a068a2.js forever since they never change
 | 
			
		||||
location ~* ^/.+\..+\.(js|css) {
 | 
			
		||||
	try_files /$lang/$uri /en-US/$uri =404;
 | 
			
		||||
	expires 1y;
 | 
			
		||||
}
 | 
			
		||||
# catch-all for all URLs i.e. /address/foo /tx/foo /block/000
 | 
			
		||||
# cache 10 minutes since they change frequently
 | 
			
		||||
location / {
 | 
			
		||||
	try_files /$lang/$uri $uri /en-US/$uri /en-US/index.html =404;
 | 
			
		||||
	expires 10m;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user