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