AARoads Forum

User Content => Photos, Videos, and More => Topic started by: Alps on October 17, 2010, 12:22:00 AM

Title: Hotlinking vs. direct linking
Post by: Alps on October 17, 2010, 12:22:00 AM
Quote from: AlpsROADS on October 17, 2010, 12:20:23 AM
Figured it out - it's a side effect of disabling hotlinking.  Unfortunately, it does not appear that I can disable hotlinking (i.e. showing my images directly) while preserving access via direct linking.  It's an all or nothing proposition.  If someone can tell me otherwise, I'd be appreciative.

Can someone tell me if there is any way to keep hotlinking disabled but direct linking enabled?
Inserting an image here: (https://www.aaroads.com/forum/proxy.php?request=http%3A%2F%2Fwww.alpsroads.net%2Froads%2Falps.jpg&hash=49c170b66dee0d68bfd36041bd26ebaad01dbdb8) should not work but http://www.alpsroads.net/roads/alps.jpg should, ideally.
Title: Re: Hotlinking vs. direct linking
Post by: NJRoadfan on October 18, 2010, 06:14:05 PM
You have to create a .htaccess file on your server to restrict hotlinking.
Title: Re: Hotlinking vs. direct linking
Post by: Alps on October 18, 2010, 06:17:35 PM
That's what I have right now, which is why "Inserting an image here" does not work.  It's the direct linking part that I don't know about.
Title: Re: Hotlinking vs. direct linking
Post by: agentsteel53 on October 18, 2010, 07:18:08 PM
alas, it appears to be non-doable without help from the client.  The server simply *cannot* tell the difference between a "HTTP GET foo.jpg referer=someothersite.com" when it's a direct link, and an identical "HTTP GET foo.jpg referer=someothersite.com" when it's a hotlink.

the browser, however, can.  If it's an IMG tag that spawned the GET, it's a hotlink.  If it's the user clicking on an A, it is a direct link.  In the case of a server returning 403 on an image, the browser should immediately check to see if the A tag is being used, and in that case resend the request with the referer stripped, spoofing a URL typed directly into a browser's address bar.  

It's an easy-as-Hell solution and I can't believe no browser has implemented it yet.

(if a browser wants to not play nice, it would strip the referer in the case of an IMG as well, thereby bypassing the hotlinking controls of the server.  But that wouldn't be nice.)
Title: Re: Hotlinking vs. direct linking
Post by: Alps on October 18, 2010, 10:01:27 PM
Quote from: agentsteel53 on October 18, 2010, 07:18:08 PM

(if a browser wants to not play nice, it would strip the referer in the case of an IMG as well, thereby bypassing the hotlinking controls of the server.  But that wouldn't be nice.)
Egads man, genius!  I want one.
Title: Re: Hotlinking vs. direct linking
Post by: Scott5114 on October 21, 2010, 10:26:37 PM
I'm kind of surprised nobody has done a Firefox extension to do that yet.