Fix caching headers on Docker image
This commit is contained in:
		
					parent
					
						
							
								30688715cd
							
						
					
				
			
			
				commit
				
					
						d9b0e08ea2
					
				
			
		
					 1 changed files with 16 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -2,9 +2,24 @@ server {
 | 
			
		|||
    listen       8080;
 | 
			
		||||
    server_name  localhost;
 | 
			
		||||
 | 
			
		||||
    location / {
 | 
			
		||||
    root   /app;
 | 
			
		||||
 | 
			
		||||
    location / {
 | 
			
		||||
        # disable cache entriely by default (apart from Etag which is accurate enough)
 | 
			
		||||
        add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
 | 
			
		||||
        if_modified_since off;
 | 
			
		||||
        expires off;
 | 
			
		||||
        # also turn off last-modified since they are just the timestamps of the file in the docker image
 | 
			
		||||
        # and may or may not bear any resemblance to when the resource changed
 | 
			
		||||
        add_header Last-Modified "";
 | 
			
		||||
 | 
			
		||||
        try_files $uri /$uri /index.html;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # assets can be cached because they have hashed filenames
 | 
			
		||||
    location /assets {
 | 
			
		||||
        expires 1w;
 | 
			
		||||
        add_header Cache-Control "public, no-transform";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue