LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > How to use X-Sendfile or X-Accel-Redirect in LiteSpeed 4.1.3

Reply
 
Thread Tools Display Modes
  #1  
Old 10-21-2012, 08:56 PM
b0ngma01 b0ngma01 is offline
New Member
 
Join Date: Oct 2012
Posts: 9
Unhappy How to use X-Sendfile or X-Accel-Redirect in LiteSpeed 4.1.13

Dear Staff,

I've installed LSW 4.1.13 but i have a question is: How to use X-Sendfile or X-Accel-Redirect?
I've read your wiki at http://www.litespeedtech.com/support...ernal_redirect, and i try with code:
PHP Code:
<?
header
("Content-type: application/java-archive");
header("X-Sendfile: HOT_GAME.jar");
?>
But download file is empty.
EX: My domain is: http://xinh.im, and direct download org file is http://xinh.im/HOT_GAME.jar , php file X-Sendfile is: http://xinh.im/t.php, when i download with http://xinh.im/t.php it response file is empty.

Please help me,

Last edited by b0ngma01; 10-21-2012 at 09:29 PM..
Reply With Quote
  #2  
Old 10-22-2012, 01:28 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
according to http://www.litespeedtech.com/support...ernal_redirect, should be
PHP Code:
<?php
header
("X-LiteSpeed-Location: /HOT_GAME.jar");
?>
Reply With Quote
  #3  
Old 10-22-2012, 01:31 AM
b0ngma01 b0ngma01 is offline
New Member
 
Join Date: Oct 2012
Posts: 9
Quote:
Originally Posted by NiteWave View Post
according to http://www.litespeedtech.com/support...ernal_redirect, should be
PHP Code:
<?php
header
("X-LiteSpeed-Location: /HOT_GAME.jar");
?>
I've changed and you can see by click: http://xinh.im/t.php
But if don't have content type, it is error.
Reply With Quote
  #4  
Old 10-22-2012, 02:50 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
my local tests shows
PHP Code:
<?php
header
("X-LiteSpeed-Location: /HOT_GAME.jar");
?>
works. will prompt you to down t.php

accessing domain.com/t.php is same to access domain.com/HOT_GAME.jar directly.

my tests also shows
header("Content-type: application/java-archive");
will be ignored. however, since the built-in MIME is "application/java-archive", so it does have a MIME type.

you can simply test it with
"curl -I domain.com/t.php" on a linux terminal.

Last edited by NiteWave; 10-22-2012 at 04:30 AM..
Reply With Quote
  #5  
Old 10-22-2012, 03:18 AM
b0ngma01 b0ngma01 is offline
New Member
 
Join Date: Oct 2012
Posts: 9
Quote:
Originally Posted by NiteWave View Post
my local tests shows
PHP Code:
<?php
header
("X-LiteSpeed-Location: /HOT_GAME.jar");
?>
works. will prompt you to down t.php

it's same behavior when you access domain.com/HOT_GAME.jar directory.

my tests also shows
header("Content-type: application/java-archive");
will be ignored. however, since the built-in MIME is "application/java-archive", so it does have a MIME type.

you can simply test it with
"curl -I domain.com/t.php" on a linux terminal.
Okay, i've got it
Thank you so much!
Reply With Quote
  #6  
Old 10-22-2012, 03:26 AM
b0ngma01 b0ngma01 is offline
New Member
 
Join Date: Oct 2012
Posts: 9
Dear NiteWave,

I have a question, please help me. I see at http://www.litespeedtech.com/support...ernal_redirect how to Protect folder, but i think i don't understand how to protect all file, folder & subfolder.
EX: I have http://domain.com/data/subfolder/file.mp3
php file download is http://domain.com/dl.php
So, How to protect with .htaccess ? Here is my .htaccess
Code:
RewriteEngine On
RewriteCond %{ORG_REQ_URI} ^/data/
RewriteRule ^/data/ - [R=403,F]
But it not work.
Reply With Quote
  #7  
Old 10-22-2012, 04:36 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
there are 2 kinds of rewrite rules: per directory and per server.
the one you post is per server rule. in .htaccess, should use per directory.

in this case, please try following:
Code:
RewriteEngine On
RewriteCond %{ORG_REQ_URI} ^/data/
RewriteRule ^data/(.*) - [R=403,F]
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:46 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.