in reply to CGI Cookie Inconsistencies

You're overlooking an old standard. Most browsers/servers do the right thing and it might not be your issue but following the spec is better. URIs in redirects are supposed to be absolute-

use URI (); my $uri = URI->new( $cgi->url ); ( my $path = $uri->path ) =~ s![^/]+\z!!; $uri->path( $path || "/" ); $uri->query_form( a => undef ); print $cgi->redirect(-cookie => $sessionidCookie, -uri => $uri);

Untested but it looks right.

Replies are listed 'Best First'.
Re^2: CGI Cookie Inconsistencies
by ranqor (Initiate) on Nov 05, 2009 at 05:12 UTC
    The redirect part works just fine for all users, would the URI somehow be affecting the cookie even though it redirects as expected? I'm in the unique position of not being able to reproduce the issue here (if someone knows how to reproduce this issue, that would be a huge help), so if I present a fix to the users I want to be almost certain its going to work.

      It might not be the/a problem but I can see it dropping the other headers while doing a redispatch depending on the engine. This issue caused an extremely bizarre and maddeningly difficult bug in some modperl I worked on once (it would execute an entirely unrelated handler on some relative redirects). The point here being, it's wrong as is and when you break standards you get unspecified behavior whether or not it's causing the bug your users are reporting. Try patching it. Verify it's reasonable in your own environment (I didn't test it though I've done a lot of this stuff) then push it out to a user who is seeing the bug and get some feedback.

        I know exactly what you mean about the standards thing, especially in IE. I've got the code updated using the proper URI. I'll report back in the am when I've heard back from the users.
Re^2: CGI Cookie Inconsistencies
by Anonymous Monk on Nov 05, 2009 at 08:17 UTC

      ./ is likely only be the same directory as the script and not the script's URI so your suggestion is broken (not absolute) and likely to be wrong since most folks don't setup their CGIs to dispatch to "directory" names. :)

        I don't think so.
      Err, you want -absolute => 1 or
      CGI->new({a =>''})->self_url