]> git.openstreetmap.org Git - rails.git/blobdiff - config/nginx.conf
Improve comments.
[rails.git] / config / nginx.conf
index 1108be5dc4b9b295183b3c235ab719d0011f5d7f..5071a260b1fa3b0b88bf08414107d1406462c53c 100644 (file)
@@ -157,7 +157,22 @@ http {
  
         # Strip asset tags
         location ~ ^/(images|javascripts|openlayers|stylesheets|user/image)/ {
+            # Strip asset tags
             rewrite ^/(.*)/[0-9]+$ /$1;
+
+            # Set expiry to the maximum - the asset tag will change
+            # when there is a new version
+            expires max;
+
+            # Only cache OpenLayers for seven days though
+            if ($uri ~ ^/openlayers/) {
+                expires 7d;
+            }
+        }
+
+        # Cache the embedded map page for seven days
+        location ~ ^/export/embed.html$ {
+            expires 7d;
         }
 
         # Include fastcgi configuration
@@ -205,17 +220,6 @@ http {
             return 404;
         }
             
-        # Handle Special Case Expiry
-        location ~ ^/openlayers/ {
-            expires 7d;
-        }
-        location ~ ^/export/embed.html$ {
-            expires 7d;
-        }
-        location ~ ^/(images|javascripts|stylesheets)/ {
-            expires max;
-        }
-
         # Send everything else to the web backend unless it exists
         # in the rails public tree    
         location / {