diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index c041d0bee08f409b0273086b5d76f40a511f8923..bd92f4730f02f401f01d9785cbf3c513b66197bd 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -118,6 +118,7 @@ $conf['rss_update'] = 5*60;              //Update the RSS feed every n minutes (
 $conf['recent_days'] = 7;                //How many days of recent changes to keep. (days)
 $conf['rss_show_summary'] = 1;           //Add revision summary to title? 0|1
 $conf['broken_iua']  = 0;                //Platform with broken ignore_user_abort (IIS+CGI) 0|1
+$conf['xsendfile']   = 0;                //Use X-Sendfile (1 = lighttpd, 2 = standard)
 
 //Set target to use when creating links - leave empty for same window
 $conf['target']['wiki']      = '';
diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php
index 71ec2870bed28f3edc26b936bc61f84b9b19776b..d29ed9f64f0f6be1313696f30d470c97b46bb0e1 100644
--- a/lib/exe/fetch.php
+++ b/lib/exe/fetch.php
@@ -104,16 +104,28 @@ function sendFile($file,$mime,$cache){
     header('Cache-Control: must-revalidate, no-transform, post-check=0, pre-check=0');
     header('Pragma: public');
   }
-  header('Accept-Ranges: bytes');
   //send important headers first, script stops here if '304 Not Modified' response
   http_conditionalRequest($fmtime);
-  list($start,$len) = http_rangeRequest(filesize($file));
+
 
   //application mime type is downloadable
   if(substr($mime,0,11) == 'application'){
     header('Content-Disposition: attachment; filename="'.basename($file).'";');
   }
 
+  //use x-sendfile header to pass the delivery to compatible webservers
+  if($conf['xsendfile'] == 1){
+    header("X-LIGHTTPD-send-file: $file");
+    exit;
+  }elseif($conf['xsendfile'] == 2){
+    header("X-Sendfile: $file");
+    exit;
+  }
+
+  //support download continueing
+  header('Accept-Ranges: bytes');
+  list($start,$len) = http_rangeRequest(filesize($file));
+
   // send file contents
   $fp = @fopen($file,"rb");
   if($fp){
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index e0b9a95af0d793a75773707f7405ab5146a16184..639c138f38f2b77c3975097842767aa85f6f8ba1 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -125,6 +125,7 @@ $lang['hidepages']   = 'Hide matching pages (regular expressions)';
 $lang['send404']     = 'Send "HTTP 404/Page Not Found" for non existing pages';
 $lang['sitemap']     = 'Generate Google sitemap (days)';
 $lang['broken_iua']  = 'Is the ignore_user_abort function broken on your system? This could cause a non working search index. IIS+PHP/CGI is known to be broken. See <a href="http://bugs.splitbrain.org/?do=details&amp;task_id=852">Bug 852</a> for more info.';
+$lang['xsendfile']   = 'Use the X-Sendfile header to let the webserver deliver static files? Your webserver needs to support this.';
 
 $lang['rss_type']    = 'XML feed type';
 $lang['rss_linkto']  = 'XML feed links to';
@@ -199,3 +200,7 @@ $lang['compression_o_0']   = 'none';
 $lang['compression_o_gz']  = 'gzip';
 $lang['compression_o_bz2'] = 'bz2';
 
+/* xsendfile header */
+$lang['xsendfile_o_0'] = "don't use";
+$lang['xsendfile_o_1'] = 'Propritary lighttpd header (before release 1.5)';
+$lang['xsendfile_o_2'] = 'Standard X-Sendfile header';
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index 3609b0cf5e95985e25c0f77f4d87d3b29e793c92..1f886737d2119a052568e8a5b492d35c8712771b 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -172,6 +172,7 @@ $meta['rss_update']  = array('numeric');
 $meta['recent_days'] = array('numeric');
 $meta['rss_show_summary'] = array('onoff');
 $meta['broken_iua']  = array('onoff');
+$meta['xsendfile']   = array('multichoice','_choices' => array(0,1,2));
 
 $meta['_network']    = array('fieldset');
 $meta['proxy____host'] = array('string','_pattern' => '#^(|[a-z0-9\-\.+]+)$#i');