diff src/goodjava/webserver/handlers/FileHandler.java @ 1607:fa066aaa068c

nginx caching
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 30 Apr 2021 20:23:28 -0600
parents 8a7519dee55c
children
line wrap: on
line diff
--- a/src/goodjava/webserver/handlers/FileHandler.java	Tue Apr 20 18:06:50 2021 -0600
+++ b/src/goodjava/webserver/handlers/FileHandler.java	Fri Apr 30 20:23:28 2021 -0600
@@ -44,7 +44,7 @@
 				DateFormat fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
 				fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
 				String lastModified = fmt.format(new Date(file.lastModified()));
-				String ifMod = (String)request.headers.get("if-modified-since");
+				String ifMod = (String)request.headers.get("If-Modified-Since");
 				if( ifMod != null ) {
 					try {
 						Date ifModDate = fmt.parse(ifMod);
@@ -55,7 +55,7 @@
 
 					} catch(ParseException e) {}
 				}
-				response.headers.put("last-modified",lastModified);
+				response.headers.put("Last-Modified",lastModified);
 
 				response.body = new Response.Body( file.length(), new FileInputStream(file) );
 				return response;