Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
litespeed_wiki:cloudlinux:disable-xsendfile-in-redmine [2018/06/26 08:29] Tihomir created |
litespeed_wiki:cloudlinux:disable-xsendfile-in-redmine [2018/06/28 14:17] (current) Lisa Clarke Proofreading |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Potential problem ==== | + | ====== Disabling X-Sendfile in Ruby Apps ====== |
+ | By default LiteSpeed supports X-Sendfile internal redirects for Ruby on Rails, but for shared hosting environments, that can trigger problems. For example, the user will not have permissions to access the Redmine directory. | ||
- | By default LiteSpeed support **X-Sendfile** or **X-Accel-Redirect** internal redirects for Ruby on Rails but for shared hosting environment that can trigger problems like the fact that the user will not have permissions to access the redmine directory. | + | ===== Solution ===== |
+ | Go to your Redmine folder and put the following in the ''.htaccess'' file: | ||
+ | SetEnv RACK_NO_XSENDFILE 1 | ||
- | ==== Solution ==== | + | **Note:** This is an example for Redmine but you can use the same solution in //any// Ruby on Rails application. |
- | + | ||
- | First you will need to edit the file: | + | |
- | + | ||
- | <code> /usr/local/lsws/fcgi-bin/RackRunner.rb </code> | + | |
- | + | ||
- | Find this line: | + | |
- | + | ||
- | <code> if body.respond_to?(:to_path) </code> | + | |
- | + | ||
- | and change it to: | + | |
- | + | ||
- | <code> | + | |
- | if body.respond_to?(:to_path) and env["RACK_NO_XSENDFILE"] != "1" | + | |
- | headers['X-LiteSpeed-Location'] = body.to_path | + | |
- | #headers['Content-Length'] = '0' | + | |
- | headers.delete('Content-Length') #Correct? | + | |
- | </code> | + | |
- | + | ||
- | That way you can control **X-Sendfile** setting via **.htaccess** file. Go to you redmine folder and put that in the **.htaccess** file: | + | |
- | + | ||
- | <code> SetEnv RACK_NO_XSENDFILE 1 </code> | + | |
- | + | ||
- | ==== Additionally information ==== | + | |
- | + | ||
- | This is an example for redmine but you can use that in any Ruby on Rails application. | + |