Custom 404 causes problems with cookie

This is a discussion on Custom 404 causes problems with cookie within the Apache Web Server forums, part of the Web Server and Related Forums category; In httpd.conf I added ErrorDocument 404 /404/index.php between the <Directory /> and </Directory> tags. ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-15-2004
gorf
 
Posts: n/a
Default Custom 404 causes problems with cookie

In httpd.conf I added ErrorDocument 404 /404/index.php between the
<Directory /> and </Directory> tags.

In the body I set a cookie called ABC as follows.

// Set the ABC cookie, the value determines where the user's browser is
directed after
// logging in.
if ( $_SERVER['QUERY_STRING'] <> "" ) {
$strGLOBAL_QSAddOn = "?" . $_SERVER['QUERY_STRING'];
} else {
$strGLOBAL_QSAddOn = "";
}
$strGLOBAL_CurrentURL = "http://" . $_SERVER['HTTP_HOST'] .
$_SERVER['PHP_SELF'] . $strGLOBAL_QSAddOn;

header("set-cookie: DOC=" . $strGLOBAL_CurrentURL . "; path=/;
domain=.utexas.edu");

Before I added the custom 404 the system worked fine. ABC contained a
string representing the current URL.

Now it seems that the cookie is being set twice. Before the page loads the
browser attempts to set the cookie with the correct URL. After the page
loads it attempts to set the same cookie with
http://invalid.com/404/index.php.

If I remove the ErrorDocument line (see above), it works as intended.
Anyone know why this would happen?

--
gorf


  #2 (permalink)  
Old 01-15-2004
gorf
 
Posts: n/a
Default Re: Custom 404 causes problems with cookie [MORE INFO]

"gorf" <ask@invalid.com> wrote in message
news:bu6bcg$j7k$1@geraldo.cc.utexas.edu...
> In httpd.conf I added ErrorDocument 404 /404/index.php between the
> <Directory /> and </Directory> tags.


NM, seems that even if a file exists, if it references anything that doesn't
exist (even a spacer image with a typo in the file name) the status changes
to 404 and the header is re-written. At least that's my guess.

Anyway, I fixed that one img tag and now the cookie is only set once.

--
gorf


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0