Send HTTP header Vary: Cookie to prevent localization cache bug
Fixes #477
This commit is contained in:
		
							parent
							
								
									41d1df8a99
								
							
						
					
					
						commit
						2d19d21532
					
				@ -7,10 +7,11 @@
 | 
			
		||||
 | 
			
		||||
	# fallback for all URLs i.e. /address/foo /tx/foo /block/000
 | 
			
		||||
	location / {
 | 
			
		||||
		add_header Vary Cookie;
 | 
			
		||||
		try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect;
 | 
			
		||||
	}
 | 
			
		||||
	location @index-redirect {
 | 
			
		||||
		add_header vary accept-language;
 | 
			
		||||
		add_header Vary Cookie;
 | 
			
		||||
		rewrite (.*) /$lang/index.html;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -18,10 +19,12 @@
 | 
			
		||||
 | 
			
		||||
	# used to rewrite resources from /<lang>/ to /en-US/
 | 
			
		||||
	location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/resources/ {
 | 
			
		||||
		add_header Vary Cookie;
 | 
			
		||||
		rewrite ^/[a-zA-Z-]*/resources/(.*) /en-US/resources/$1;
 | 
			
		||||
	}
 | 
			
		||||
	# used for cookie override
 | 
			
		||||
	location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/ {
 | 
			
		||||
		add_header Vary Cookie;
 | 
			
		||||
		try_files $uri $uri/ /$1/index.html =404;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -35,15 +35,17 @@
 | 
			
		||||
		location / {
 | 
			
		||||
			try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect;
 | 
			
		||||
			add_header Cache-Control "public, no-transform";
 | 
			
		||||
			add_header Vary Cookie;
 | 
			
		||||
			expires 10m;
 | 
			
		||||
		}
 | 
			
		||||
		location /resources {
 | 
			
		||||
			try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect;
 | 
			
		||||
			add_header Cache-Control "public, no-transform";
 | 
			
		||||
			add_header Vary Cookie;
 | 
			
		||||
			expires 1h;
 | 
			
		||||
		}
 | 
			
		||||
		location @index-redirect {
 | 
			
		||||
			add_header vary accept-language;
 | 
			
		||||
			add_header Vary Cookie;
 | 
			
		||||
			rewrite (.*) /$lang/index.html;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -55,6 +57,7 @@
 | 
			
		||||
		}
 | 
			
		||||
		# used for cookie override
 | 
			
		||||
		location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/ {
 | 
			
		||||
			add_header Vary Cookie;
 | 
			
		||||
			try_files $uri $uri/ /$1/index.html =404;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user