]> git.openstreetmap.org Git - rails.git/blobdiff - config/lighttpd.conf
Update cross domain policy to only allow API access.
[rails.git] / config / lighttpd.conf
index ffe2ea4f3adb364752b2201e6246794826bb0744..7a9e241452cc9ebf2dd80dc328e383bb7c6b4b23 100644 (file)
@@ -4,9 +4,12 @@
 server.modules = ( 
   "mod_access",
   "mod_accesslog",
+  "mod_cgi",
   "mod_compress",
   "mod_evasive",
+  "mod_expire",
   "mod_fastcgi",
+  "mod_redirect",
   "mod_status"
 )
 
@@ -29,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
@@ -40,6 +44,12 @@ $HTTP["url"] =~ "^/api/0.3/" { url.access-deny = ("") }
 #
 $HTTP["remoteip"] == "143.210.16.160" { url.access-deny = ("") }
 
+#
+# Rule to block tilesAtHome when somebody decides to queue vast 
+# number of tiles for rerendering
+#
+#$HTTP["useragent"] == "tilesAtHome" { url.access-deny = ("") }
+
 #
 # Limit connections to 20 per IP address
 #
@@ -55,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
 #
@@ -69,11 +87,35 @@ 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
 #
 compress.cache-dir = "/var/cache/lighttpd"
 
+#
+# Redirect trac and wiki requests to the right places
+#
+url.redirect = ( 
+  "^/trac/(.*)$" => "http://trac.openstreetmap.org/$1",
+  "^/wiki/(.*)$" => "http://wiki.openstreetmap.org/$1"
+)
+
+#
+# Run anything with a .pl iextension as a CGI script
+#
+cgi.assign = ( ".pl" => "/usr/bin/perl" )
+
 #
 # Serve static content from the rails public area ourselves
 #