I run Kolab 3.4 on a server only accessible from the local network. For remote access I run a smaller
roundcube instance with only some plugins on an internet exposed host. For file access I use:
```
$config['fileapi_backend'] = 'kolab';
$config['fileapi_drivers'] = array('seafile');
$config['fileapi_seafile_host'] = 'kolab3.example.org/seafile/';
```
That seems to work - in roundcube with kolab_files enabled I see my seafile libraries, but when I try
to access a file, the browser wants to load the file directly from the seafile host which is not exposed.
Some reading in chwala led me to chwala/lib/drivers/seafile/seafile_file_storage.php, ~ line 500:
// just send redirect to SeaFile server
if ($file['size']) {
header("Location: $link");
That wont work for me. The following patch seems to work:
```
--- chwala/lib/drivers/seafile/seafile_file_storage.php.orig 2017-01-21 15:21:24.647750300 +0100
+++ chwala/lib/drivers/seafile/seafile_file_storage.php 2017-01-21 15:46:06.883436733 +0100
@@ -505,9 +505,28 @@
header("Content-Length: " . $file['size']);
header("Content-Disposition: $disposition; filename=\"$filename\"");
- // just send redirect to SeaFile server
+ // proxy the file from the seafile server
if ($file['size']) {
- header("Location: $link");
+ $myoptions = array(
+ CURLOPT_RETURNTRANSFER => true, // return web page
+ CURLOPT_HEADER => false, // return headers
+ CURLOPT_FOLLOWLOCATION => true, // follow redirects
+ CURLOPT_ENCODING => "", // handle all encodings
+ CURLOPT_AUTOREFERER => true, // set referer on redirect
+ CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
+ CURLOPT_TIMEOUT => 120, // timeout on response
+ CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
+ );
+
+ $ch = curl_init( $link );
+ curl_setopt_array( $ch, $myoptions );
+ $remoteSite = curl_exec( $ch );
+ //$header = curl_getinfo( $ch );
+ curl_close( $ch );
+
+ //$header['content'] = $remoteSite;
+
+ echo($remoteSite);
}
die;
}
```