You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Alexander <mo...@humak.edu> on 2003/03/04 12:56:07 UTC

$r->headers_in->get('Referer') doesn't work with IE

Hi,

I using recipe 10.4 from the mod_perl cookbook.

in

sub logout ($$) {

  # I'm setting the logout address to be the login page again. My login page
  # is made up of /bin/$environment_name/
  # With Netscape it works fine ..

  my ($self, $r) = @_;
  my $uri = $r->headers_in->get('Referer') ;
  my @split = split /\//, $uri ;
  my $db = $split[4] ;

  $self->SUPER::logout($r);

  my $logout_address = "/bin/" . $db . "/" ;
  $r->headers_out->set(Location => "$logout_address");


  return REDIRECT;

}

Checking the log file for netscape everything is as expected.

User can login, work, logout -> back to login page ready for next user.

But with IE 6.0 the $r->uri and $r->headers_in->get('Referer') is
different than for NN. It is the next page being called in this case just
/logout so I no longer know what was my db value.

Any ideas how to solve this?

Scott






Re: $r->headers_in->get('Referer') doesn't work with IE

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> But with IE 6.0 the $r->uri and $r->headers_in->get('Referer') is
> different than for NN. 

as you're seeing, the Referer header is pretty unreliable due to the 
different ways browsers implement it.

you should probably switch to a different method for this, such as 
specifying the environment through a PerlSetVar, or maybe passing it around 
in a form field, the query string, or extra path info or something.

HTH

--Geoff