Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 2nd, 2009, 02:10 AM
ryand ryand is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Location: Auckland
Posts: 82 ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 57 m 48 sec
Reputation Power: 19
mod_rewrite - File protection


Hello all,
I am currently looking after a video streaming site. few days back , we moved all our video files to S3 (amazon cloud).
Therefore, our site has become distributed where we host the PHP files on File Server & media at cloud.


The problem is, I need to protect my videos & not want to allow user to see the URL path of the video. by not doing so, user can easily see URL & can download the videos easily.

atleast, i need to make sure that every video request should go to the fake URL or PHP page some thing like that.

Your help / suggestions are appreciated.

Thanks.



Reply With Quote
  #2  
Old July 3rd, 2009, 12:18 AM
requinix's Avatar
requinix requinix is offline
nuts - top 5 poster again :(
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 5,301 requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)  Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Months 9 h 54 m 20 sec
Reputation Power: 2967
Send a message via MSN to requinix
There is no perfect solution. Be aware of that.

The client is going to see the URL one way or another: maybe through the Flash player (which requests the video), maybe through a direct link. You can't get around that without loading the video through your own site - which defeats the purpose of using S3.

You can, however, give a time limit on when the user can access the file. If you mark the videos as ACL:private you can pass information through the URL to the S3 server giving access on a case-by-case basis. The information (authentication information) has a time limit.
Look at the REST developer API for how it's done.

So make a page to redirect the browser to the location of the video with the authentication information included; point your video player at this location, not the S3 address.
__________________
How to ask a PHP question | My stuff

Last edited by requinix : July 3rd, 2009 at 12:21 AM. Reason: blasted smilies

Reply With Quote
  #3  
Old July 3rd, 2009, 12:36 AM
ryand ryand is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Location: Auckland
Posts: 82 ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 57 m 48 sec
Reputation Power: 19
Quote:
Originally Posted by requinix
There is no perfect solution. Be aware of that.

The client is going to see the URL one way or another: maybe through the Flash player (which requests the video), maybe through a direct link. You can't get around that without loading the video through your own site - which defeats the purpose of using S3.

You can, however, give a time limit on when the user can access the file. If you mark the videos as ACLrivate you can pass information through the URL to the S3 server giving access on a case-by-case basis. The information (authentication information) has a time limit.
Look at the REST developer API for how it's done.

So make a page to redirect the browser to the location of the video with the authentication information included; point your video player at this location, not the S3 address.


Thanks requinix a lot.

Let me have try on this. ( Just a small query ; can we have a rewrite rule to point mysite.com/x.flv to http://amzon.....s3.com/video/x.flv ?)

Last edited by ryand : July 3rd, 2009 at 01:09 AM.

Reply With Quote
  #4  
Old July 3rd, 2009, 01:49 AM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Dec 2004
Posts: 3,227 E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 16th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 17 h 39 m 4 sec
Reputation Power: 2061
Yes you could, but it would have to be a redirect rule and not an invisible rewrite, so the user would see the amazon URL in their browser anyway.

Reply With Quote
  #5  
Old July 3rd, 2009, 02:23 AM
ryand ryand is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Location: Auckland
Posts: 82 ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 57 m 48 sec
Reputation Power: 19
Post

Quote:
Originally Posted by E-Oreo
Yes you could, but it would have to be a redirect rule and not an invisible rewrite, so the user would see the amazon URL in their browser anyway.




can you show me how the RULE looks like ? may be i can try myself to build advanced one ?

Reply With Quote
  #6  
Old July 3rd, 2009, 04:14 AM
requinix's Avatar
requinix requinix is offline
nuts - top 5 poster again :(
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 5,301 requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)requinix User rank is General 30th Grade (Above 100000 Reputation Level)  Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1Folding Points: 161153 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Months 9 h 54 m 20 sec
Reputation Power: 2967
Send a message via MSN to requinix
Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.*)\.flv$ http://s3.amazonaws.com/bucket/$1.flv

Just to repeat what Oreo said, the user will see the S3 address in their browser. That is unavoidable using any method that doesn't involve your server relaying the video.

Reply With Quote
  #7  
Old July 3rd, 2009, 04:50 AM
ryand ryand is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Location: Auckland
Posts: 82 ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 57 m 48 sec
Reputation Power: 19
Quote:
Originally Posted by requinix
Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.*)\.flv$ http://s3.amazonaws.com/bucket/$1.flv

Just to repeat what Oreo said, the user will see the S3 address in their browser. That is unavoidable using any method that doesn't involve your server relaying the video.


Agreed

Reply With Quote
  #8  
Old July 7th, 2009, 04:55 AM
ryand ryand is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Location: Auckland
Posts: 82 ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level)ryand User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 57 m 48 sec
Reputation Power: 19
I tried what "requinix" suggested i.e giving access to files on time to time basis. But this seems to be problematic in my case,because its affecting speed of the site.


With Rewrite rule we tried to mask the original location of the video ,( thats good ) like http://s3.amazon.../video/x.flv to
http://myhost/x.flv. Can we add a constraint to this RULE so that if HTTP REFERER is myhost then only service files otherwise not ?

Last edited by ryand : July 7th, 2009 at 04:58 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > mod_rewrite - File protection


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
Stay green...Green IT