mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	nginx: Add Cache-Control headers for Django-hashed static files.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Alex Vandiver
					
				
			
			
				
	
			
			
			
						parent
						
							9ad74739aa
						
					
				
				
					commit
					dc6af98e52
				
			@@ -14,17 +14,14 @@ location /static/ {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # Set a nonexistent path, so we just serve the nice Django 404 page.
 | 
					    # Set a nonexistent path, so we just serve the nice Django 404 page.
 | 
				
			||||||
    error_page 404 /django_static_404.html;
 | 
					    error_page 404 /django_static_404.html;
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # These files are hashed and thus immutable; cache them aggressively.
 | 
					    # These files are hashed and thus immutable; cache them aggressively.
 | 
				
			||||||
location /static/webpack-bundles/ {
 | 
					    # Django adds 12 hex digits; Webpack adds 20.
 | 
				
			||||||
    alias /home/zulip/prod-static/webpack-bundles/;
 | 
					    location ~ '\.[0-9a-f]{12}\.|[./][0-9a-f]{20}\.' {
 | 
				
			||||||
        include /etc/nginx/zulip-include/headers;
 | 
					        include /etc/nginx/zulip-include/headers;
 | 
				
			||||||
        add_header Access-Control-Allow-Origin *;
 | 
					        add_header Access-Control-Allow-Origin *;
 | 
				
			||||||
        add_header Cache-Control "public, max-age=31536000, immutable";
 | 
					        add_header Cache-Control "public, max-age=31536000, immutable";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    # Set a nonexistent path, so we just serve the nice Django 404 page.
 | 
					 | 
				
			||||||
    error_page 404 /django_static_404.html;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Send longpoll requests to Tornado
 | 
					# Send longpoll requests to Tornado
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user