]> git.openstreetmap.org Git - rails.git/blobdiff - config/lighttpd.conf
Commit updated dispatch rules from live server.
[rails.git] / config / lighttpd.conf
index 317413f573a7ea2db689a89196284408b0c28ca7..b5d87f1cb6d61459a662fc53d3b9fc32411c14ab 100644 (file)
@@ -7,6 +7,7 @@ server.modules = (
   "mod_cgi",
   "mod_compress",
   "mod_evasive",
+  "mod_expire",
   "mod_fastcgi",
   "mod_redirect",
   "mod_status"
@@ -31,10 +32,11 @@ server.errorlog = "/var/log/lighttpd/error.log"
 $HTTP["remoteip"] == "127.0.0.1" { status.status-url = "/server-status" }
 
 #
-# API 0.3 is long dead, so fail any attempt to access it without
+# Fail any attempt to access old versions of the API without
 # getting rails involved at all
 #
 $HTTP["url"] =~ "^/api/0.3/" { url.access-deny = ("") }
+$HTTP["url"] =~ "^/api/0.4/" { url.access-deny = ("") }
 
 #
 # IP blocked at SteveC's request as it was trying to download the
@@ -63,9 +65,17 @@ mimetype.assign = (
   ".js" => "application/x-javascript",
   ".png" => "image/png",
   ".swf" => "application/x-shockwave-flash",
-  ".txt" => "text/plain"
+  ".txt" => "text/plain",
+  ".xml" => "text/xml"
 )
 
+#
+# Force special MIME type for crossdomain.xml files
+#
+$HTTP["url"] =~ "/crossdomain\.xml$" {
+  mimetype.assign = ( ".xml" => "text/x-cross-domain-policy" )
+}
+
 #
 # Enable compression of appropriate static content
 #
@@ -77,6 +87,17 @@ compress.filetype = (
   "text/plain"
 )
 
+#
+# Set expiry for static content
+#
+expire.url = (
+  "/export/" => "access 7 days",
+  "/images/" => "access 10 years",
+  "/javascripts/" => "access 10 years",
+  "/openlayers/" => "access 7 days",
+  "/stylesheets/" => "access 10 years"
+)
+
 #
 # Cache compressed content
 #
@@ -103,8 +124,24 @@ server.document-root = "/var/www/rails/public"
 #
 # Send everything else to the appropriate FastCGI server
 #
-server.error-handler-404 = "/dispatch.fcgi"
-$HTTP["url"] =~ "^/api/" { server.error-handler-404 = "/dispatch.api" }
+$HTTP["useragent"] == "tilesAtHome" {
+  server.error-handler-404 = "/dispatch.tah"
+}
+else $HTTP["url"] =~ "^/api/0\.5/(map|trackpoints|amf|swf/trackpoints)$" {
+  server.error-handler-404 = "/dispatch.bulkapi"
+}
+else $HTTP["url"] =~ "^/api/0\.5/.*/search$" {
+  server.error-handler-404 = "/dispatch.bulkapi"
+}
+else $HTTP["url"] =~ "^/api/0\.5/" {
+  server.error-handler-404 = "/dispatch.api"
+}
+else $HTTP["url"] =~ "^/api/0\.[0-9]+/" {
+  url.access-deny = ("")
+}
+else $HTTP["url"] =~ "^/" {
+  server.error-handler-404 = "/dispatch.web"
+}
 
 #
 # Configure the FastCGI servers