Reduce nginx cache time for production homepage
This commit is contained in:
		
							parent
							
								
									d2f13eced1
								
							
						
					
					
						commit
						92da3988da
					
				@ -46,13 +46,13 @@ add_header Vary Cookie;
 | 
			
		||||
# https://stackoverflow.com/questions/5238377/nginx-location-priority
 | 
			
		||||
 | 
			
		||||
# for exact / requests, redirect based on $lang
 | 
			
		||||
# cache redirect for 10 minutes
 | 
			
		||||
# cache redirect for 5 minutes
 | 
			
		||||
location = / {
 | 
			
		||||
	if ($lang != '') {
 | 
			
		||||
		return 302 $scheme://$host/$lang/;
 | 
			
		||||
	}
 | 
			
		||||
	try_files /en-US/index.html =404;
 | 
			
		||||
	expires 10m;
 | 
			
		||||
	expires 5m;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# used to rewrite resources from /<lang>/ to /en-US/
 | 
			
		||||
@ -66,14 +66,14 @@ location ~ ^/([a-z][a-z])/(.+\..+\.(js|css)) {
 | 
			
		||||
	try_files $uri =404;
 | 
			
		||||
	expires 1y;
 | 
			
		||||
}
 | 
			
		||||
# cache everything else for 10 minutes
 | 
			
		||||
# cache everything else for 5 minutes
 | 
			
		||||
location ~ ^/([a-z][a-z])$ {
 | 
			
		||||
	try_files $uri /$1/index.html /en-US/index.html =404;
 | 
			
		||||
        expires 10m;
 | 
			
		||||
        expires 5m;
 | 
			
		||||
}
 | 
			
		||||
location ~ ^/([a-z][a-z])/ {
 | 
			
		||||
	try_files $uri /$1/index.html /en-US/index.html =404;
 | 
			
		||||
        expires 10m;
 | 
			
		||||
        expires 5m;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# cache /resources/** for 1 week since they don't change often
 | 
			
		||||
@ -87,8 +87,8 @@ location ~* ^/.+\..+\.(js|css) {
 | 
			
		||||
	expires 1y;
 | 
			
		||||
}
 | 
			
		||||
# catch-all for all URLs i.e. /address/foo /tx/foo /block/000
 | 
			
		||||
# cache 10 minutes since they change frequently
 | 
			
		||||
# cache 5 minutes since they change frequently
 | 
			
		||||
location / {
 | 
			
		||||
	try_files /$lang/$uri $uri /en-US/$uri /en-US/index.html =404;
 | 
			
		||||
	expires 10m;
 | 
			
		||||
	expires 5m;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user