hotlinking

Preventing Amazon Cloudfront hotlinking

江枫思渺然 提交于 2019-11-28 06:52:57
I use Amazon Cloudfront to host all my site's images and videos, to serve them faster to my users which are pretty scattered across the globe. I also apply pretty aggressive forward caching to the elements hosted on Cloudfront, setting Cache-Control to public, max-age=7776000 . I've recently discovered to my annoyance that third party sites are hotlinking to my Cloudfront server to display images on their own pages, without authorization. I've configured .htaccess to prevent hotlinking on my own server, but haven't found a way of doing this on Cloudfront, which doesn't seem to support the

IMDB Poster URL Returns Referral Denied

≯℡__Kan透↙ 提交于 2019-11-28 02:01:08
问题 In my Ruby on Rails app, I use the imdb gem (https://rubygems.org/gems/imdb) to search for a movie by title and grab the poster url and add it to the movie model I have in my database. Then in my view, I put that url in an image source tag and display the image to the user. I don't have any problems when I'm running my application locally, but when I deploy it to Heroku, sometimes a few images are rendered successfully but for the most part, they aren't displayed properly. I've tried multiple

How to protect against direct access to images?

纵饮孤独 提交于 2019-11-27 19:28:23
I would like to create a web site with many images. But I would like to protect against direct access to images, e.g. direct links to images without visiting the web site. What is the preferred way to do this? And what are the alternatives with Pros and cons? I have some ideas (I don't know if they are possible): File permissions PHP Sessions Temporary file names or URLs HTTP Redirection? Maybe this isn't practiced on many web sites? E.g. I tried to access a private photo on Facebook without beeing logged in, but I could still visit the photo. The platform will probably be a Ubuntu machine

PHP: How can I block direct URL access to a file, but still allow it to be downloaded by logged in users?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 02:43:55
I have a website where users should be able to log in and listen to a song (a self-created mp3). I want to make it so the logged in user can listen/download/whatever, and the file should reside on the server (not be stored in the MySQL database), but not be able to be accessed by non-users who have the path to the URL. For example: say my mp3 is located at mysite.com/members/song.mp3 If you are logged in, you should be able to see the mysite.com/members/index.php page, which will allow access to the song.mp3 file. If you're not logged in, the mysite.com/members/index.php page will not show you

Preventing Amazon Cloudfront hotlinking

妖精的绣舞 提交于 2019-11-27 01:34:12
问题 I use Amazon Cloudfront to host all my site's images and videos, to serve them faster to my users which are pretty scattered across the globe. I also apply pretty aggressive forward caching to the elements hosted on Cloudfront, setting Cache-Control to public, max-age=7776000 . I've recently discovered to my annoyance that third party sites are hotlinking to my Cloudfront server to display images on their own pages, without authorization. I've configured .htaccess to prevent hotlinking on my

How to protect against direct access to images?

£可爱£侵袭症+ 提交于 2019-11-26 19:45:47
问题 I would like to create a web site with many images. But I would like to protect against direct access to images, e.g. direct links to images without visiting the web site. What is the preferred way to do this? And what are the alternatives with Pros and cons? I have some ideas (I don't know if they are possible): File permissions PHP Sessions Temporary file names or URLs HTTP Redirection? Maybe this isn't practiced on many web sites? E.g. I tried to access a private photo on Facebook without

Allow/deny image hotlinking with .htaccess

血红的双手。 提交于 2019-11-26 17:46:44
So I've got this in my site .htaccess file to prevent hotlinking of images, JS and CSS from all other domains. RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.com [NC] RewriteRule \.(gif|jpe?g|js|css)$ - [F,NC,L] Question: How would I selectively allow one or two domains to hotlink? RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.com [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?otherdomain\.com [NC] RewriteRule \.(gif|jpe?g|js|css)$ - [F,NC,L] Will work, as this says. "Refererr is not nothing, and referer is not

PHP: How can I block direct URL access to a file, but still allow it to be downloaded by logged in users?

拥有回忆 提交于 2019-11-26 10:08:48
问题 I have a website where users should be able to log in and listen to a song (a self-created mp3). I want to make it so the logged in user can listen/download/whatever, and the file should reside on the server (not be stored in the MySQL database), but not be able to be accessed by non-users who have the path to the URL. For example: say my mp3 is located at mysite.com/members/song.mp3 If you are logged in, you should be able to see the mysite.com/members/index.php page, which will allow access

Allow/deny image hotlinking with .htaccess

我与影子孤独终老i 提交于 2019-11-26 05:35:47
问题 So I\'ve got this in my site .htaccess file to prevent hotlinking of images, JS and CSS from all other domains. RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\\.)?mydomain\\.com [NC] RewriteRule \\.(gif|jpe?g|js|css)$ - [F,NC,L] Question: How would I selectively allow one or two domains to hotlink? 回答1: RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.com [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?otherdomain\.com [NC]

How to prevent a file from direct URL Access?

倖福魔咒の 提交于 2019-11-25 23:07:54
问题 I\'m using Apache and I have a sample web folder on my Local Host , like: http://localhost/test/ Files in the test folder: index.html sample.jpg .htaccess Sample source of index.html : <html> <body> <img src=\"sample.jpg\" /> </body> </html> When I run the website at http://localhost/test/ , it will simply show the image `sample.jpg\' on the page. Problem: I want to prevent the image showing as http://localhost/test/sample.jpg directly in the url bar. Note: I found that the solutions below