302 Moved Responses from Facebook.com origin requests

20 views
Skip to first unread message

graham.b...@gmail.com

unread,
Jun 24, 2015, 1:58:45 PM6/24/15
to im...@googlegroups.com
I'm writing a little script that replaces Facebook's "Trending" and "Suggested Pages" sidebar with a random image from Imgur. What I'm noticing though is within Firefox the request to i.imgur.com/<img> gets a 302 redirect to the image's gallery page.

This causes my dynamically created <img> element to fail to load since the image never gets sent.

Digging through the Googles I found this article:
http://minimaxir.com/2014/02/moved-temporarily/

Which seems to indicate that imgur does this on purpose to any requests coming from facebook. Now, this behavior likely affects what I'm attempting to do. So, is there any workaround to get the image directly without the redirect?

Oddly enough, my Chrome doesn't seem phased by this.

RepostStatistics

unread,
Jul 20, 2015, 3:30:15 PM7/20/15
to im...@googlegroups.com
There seem to be some solutions to strip the referrer with js. (use some more google).
Also you could OFC, use a proxy (server side) which removes the referrer.
Also if you are on a https site and load /redirect to a non https site, the referrer should be stripped, too.

Disclaimer: I did not test any of this, its just the result of some googleing.




RepostStatistics

unread,
Jul 20, 2015, 3:46:35 PM7/20/15
to im...@googlegroups.com
I just tested a bit.
The script linked here, worked for me in ff at least. It is using iframes as far as i can see.
http://referrer-killer.googlecode.com/git/example.html

Use it to display images like: $(document.body).append(ReferrerKiller.imageNode("https://i.imgur.com/IQNJ2VO.gif"))
I am sorry if this breaks some "feature" of imgur, but IMHO one should NEVER trust header fields anyway, and all this info is easily found with some google search..

Graham B

unread,
Jul 20, 2015, 4:45:15 PM7/20/15
to im...@googlegroups.com
Looks good! Tested on FF/Chrome and its working great. Your help is much appreciated!

(Here's the link to the extension if anyone wants to see what's probably the final revision:
https://gist.github.com/GrahamBlanshard/d7211436088e0159164a)
Reply all
Reply to author
Forward
0 new messages