mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	removes Content-Type response header if the file is cached
The content-type currently defaults to text/html, which is inaccurate because no content is being returned. Google, and many popular CDNs omit the Content-Type header for 304 response.
This commit is contained in:
		
							parent
							
								
									7908b54767
								
							
						
					
					
						commit
						875032f0dc
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		|  | @ -80,6 +80,7 @@ module Kemal | |||
|       etag = %{W/"#{File.lstat(file_path).mtime.epoch.to_s}"} | ||||
|       context.response.headers["ETag"] = etag | ||||
|       return false if !context.request.headers["If-None-Match"]? || context.request.headers["If-None-Match"] != etag | ||||
|       context.response.headers.delete "Content-Type" | ||||
|       context.response.content_length = 0 | ||||
|       context.response.status_code = 304 # not modified | ||||
|       return true | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue