Commit ad2dd0c

Daniel Axtens <dja@axtens.net>
2026-09-30 01:27:08
sigh, nginx
1 parent 2672fe8
Changed files (1)
nginx/nginx.conf
@@ -19,12 +19,18 @@ http {
 
     map_hash_bucket_size 128;
     map $uri $hash_etag {
+        default "";
+        include etag.map;
+    }
+    map $uri $hash_match_etag {
+        default "a file that isn't in our map";
         include etag.map;
     }
 
     server {
         listen       172.16.0.2:80 default_server;
 
+
         location / {
             gzip_vary     on;
             gzip_static   on;
@@ -33,6 +39,11 @@ http {
             root   /usr/local/www/blog;
             index  index.html;
 
+            # we override etags so we have to deal with matching them
+            if ($http_if_none_match = $hash_match_etag) {
+                return 304;
+            }
+
             etag off;
             if ($hash_etag != "") {
                 add_header ETag $hash_etag always;
@@ -65,6 +76,11 @@ http {
             root   /usr/local/www/;
             index index.html;
 
+            # we override etags so we have to deal with matching them
+            if ($http_if_none_match = $hash_match_etag) {
+                return 304;
+            }
+
             etag off;
             if ($hash_etag != "") {
                 add_header ETag $hash_etag always;