views:

3036

answers:

5

Hello, it seems I have run into a problem with Internet Explorer 7. I have an html page that has links to files on another server. The server I am linking to checks the referrer of the request and if the referrer is valid, it allows access to the resource. It works fine in firefox 2 and 3 (as the server my html page is located on is a valid referer) but in internet explorer it doesn't work, the other server denies me the resource(generates an http 403 error). I was doing some searching and stumbled on this http://support.microsoft.com/kb/178066 and I have tried the html page in both https and http and same thing for the server I am connecting to but I get nothing Internet explorer. what can I do to work around this?

thank you

A: 

Disable firewalls, and anti-virus /or anti-spyware checking and see if that helps. I know this may sound trollish, but I've personally seen many instances where the problem miraculously disappeared when this advice was taken.

They tend to have an overzealous idea sometimes of what "Secure" is, and break browser behaviour in the progress. ( If you have AVG and have problems with email ( pop3 ), turn off AVG and watch email magically return to working status )

Kent Fredric
If you read the linked kb article you would see that this is a known issue with IE, not influenced by other software.
Sparr
Ah, no, the kb article complains about crossing security boundaries, its clear from the OP that the problem even occurs on same-level securities, and I have, from experience, seen AV software tamper with and cause this behaviour!
Kent Fredric
( I *have* used referrers in IE, in bare http:// *and* had them work, so I'm not exactly making this up .. )
Kent Fredric
I cannot imagine worse advice that just disabling your entire security insulation across the board to "see if that helps". I *have* had problems with AVG email protection with an SSL POP3 account, for which I turned of the email filter, not *all* AVG protection.
Software Monkey
I'm not saying leave it off permanently... and besides, its is only an **illusion** of security 99% of the time. If you're only browsing your own content, I **hardly** think you're likely to get hit by ActiveX controls on your own pages.
Kent Fredric
+2  A: 

You may want to use a different mechanism anyway. Referrers are easily spoofed. Checking referrers really isn't a good security solution, and if they're going to cause you headaches like this, maybe you want to find another way.

For example, the server generating the first page could add an authorization token to the URLs to the second server, and the second server could check that the tokens are valid. This way, all of the details are under your control, and the only browser behavior you're counting on is that the full URL is sent to the second server.

Ned Batchelder
actually, i forgot to mention this part but it is using authorization tokens, Every url has the proper auth token appended to it.
willz
if you already have an auth token, then why bother with referrer checking at all?
Ned Batchelder
+4  A: 

How are you "getting to" the file in question?

IF YOU ARE USING JAVASCRIPT to get to the file, IE WILL FAIL.

IE has had a major bug since the dawn of time on this.

e.g. document.location.href = 'myNewPage.html'; //FAILS to pass referer in IE

Bug #421 over on Web Bug Track

won't be fixed in IE8 either! :-(

scunliffe
its just a plain html anchor tag. no javascript.
willz
A: 

I have resolved, include this code in all page, in your project

session_start();
if($_SERVER['SERVER_PORT'] == 443 )
 $http = 'https://';
else
 $http = 'http://';

$adress = $http.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; 

$_SESSION['referer'] = $_SESSION['current_page'];
$_SESSION['current_page'] = $adress;
$_SERVER['HTTP_REFERER'] = $_SESSION['referer'];

Sorry for my bad English ....

A: 

I'm not using IE7 so I can not check this.. but I guess this should work without problems:

<script type="text/javascript">
      document.location= "www.your-server.com/your_page.html?referrer=" + document.location.href;
</script>

And than on the the second server you can check the value of the referrer parameter instead of relying on whether browser sends the referrer or not.