FreeHostia Forums https://forum.freehostia.com/ |
|
Server Responding With 200 Ok or 302 Found instead of 404 https://forum.freehostia.com/viewtopic.php?f=4&t=10295 |
Page 1 of 1 |
Author: | charonn0 [ Wed Sep 09, 2009 7:47 pm ] |
Post subject: | Server Responding With 200 Ok or 302 Found instead of 404 |
McAfee Site Advisor tells me that my site responds to non-existent files with HTTP 200, and my own packet analysis shows the response to be 302 Found, redirected to my custom 404 page. How can I configure my site to have a custom 404 page without the server responding with a 200 or 302 response? |
Author: | charonn0 [ Wed Sep 16, 2009 8:12 am ] |
Post subject: | |
Thanks, I'll look at this in the morning after the coffee kicks in |
Author: | charonn0 [ Thu Sep 17, 2009 5:09 am ] |
Post subject: | |
Still not working. Here is my .htaccess file: Code: ErrorDocument 404 /errors/404.php The page /errors/404.php contains this at the top before the DTD declaration of the HTML: Code: <?php header("HTTP/1.0 404 Not Found"); ?> as suggested in the article you referenced. A few things I've noticed: If I specify an error document in the CPanel, then 404 errors get sent to that document, as expected, but send 302 responses instead of 404 to the client. If I do not specify an error page in CPanel but use a .htaccess file instead then all 404 errors go to https://cp.freehostia.com/404/ with a 302 response. It seems as though Freehostia isn't honoring the .htaccess file directives. When I directly request the /errors/404.php file (rather than enter an erroneous URL) then everything works the way I want it to. The server responds with a 404 header and the custom error page is displayed in the browser. Packet capture, direct request to /errors/404.php: Query: Code: No. Time Source Destination Protocol Info 9 0.129165 192.168.1.149 66.40.52.73 HTTP GET /errors/404.php HTTP/1.1 Hypertext Transfer Protocol GET /errors/404.php HTTP/1.1\r\n [Expert Info (Chat/Sequence): GET /errors/404.php HTTP/1.1\r\n] Request Method: GET Request URI: /errors/404.php Request Version: HTTP/1.1 Host: www.boredomsoft.org\r\n Response: Code: No. Time Source Destination Protocol Info 11 0.279743 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 404 Not Found (text/html) Hypertext Transfer Protocol HTTP/1.1 404 Not Found\r\n [Expert Info (Chat/Sequence): HTTP/1.1 404 Not Found\r\n] Request Version: HTTP/1.1 Response Code: 404 Line-based text data: text/html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n <html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n <title>404</title>\n <link rel="stylesheet" href="errors.css" type="text/css" />\n </head>\n <body bgcolor="#64748B">\n </head>\n \n <body>\n <p> </p>\n <p> </p>\n <p> </p>\n <p> </p>\n <table width="918" border="0" align="center">\n <tr>\n <td width="156" rowspan="4" class="bodyText"><img src="exclaimation.gif" width="151" height="151" /></td>\n <td class="bodyText"><span class="style5">HTTP Error 404: Inept or ham-handed user </span></td>\n </tr>\n <tr>\n <td width="903" bgcolor="#FFFFFF" class="bodyText"><ol>\n <strong>Emptiness</strong>:\n [truncated] <li>The state of being empty; absence of contents; void space; vacuum; as, the emptiness of a vessel; emptiness of the stomach.</li><li>Want of solidity or substance; unsatisfactoriness; inability to satisfy desire; vac <li><strong>Want of knowledge; lack of sense; vacuity of mind</strong>.</li>\n </ol></p> </td>\n </tr>\n <tr>\n <td bgcolor="#FFFFFF" class="style5"><div align="center">the page you asked for does not exist in our space-time continuum </div></td>\n </tr>\n <tr>\n <td bgcolor="#999999"><p><a href="javascript:history.go(-1)">Go back</a>, thee, from whence thou came. And darken not this URL again. For if thou dost not heed my words, then thou dost have the brain of birds. Amen </p> </td>\n </tr>\n </table>\n <p align="center"><a href="http://www.boredomsoft.org">Go To Main Page </a></p>\n </body>\n </html>\n Packet capture, requesting erroneous URL: Query: Code: No. Time Source Destination Protocol Info 20 5.876681 192.168.1.149 66.40.52.73 HTTP GET /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn HTTP/1.1 Hypertext Transfer Protocol GET /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn HTTP/1.1\r\n [Expert Info (Chat/Sequence): GET /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn HTTP/1.1\r\n] Request Method: GET Request URI: /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn Request Version: HTTP/1.1 Host: www.boredomsoft.org\r\n Response with no error document specified in CPanel: Code: No. Time Source Destination Protocol Info 22 5.905480 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 302 Found HTTP/1.1 302 Found (text/html) Hypertext Transfer Protocol HTTP/1.1 302 Found\r\n [Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n] Request Version: HTTP/1.1 Response Code: 302 Hypertext Transfer Protocol HTTP/1.1 302 Found\r\n [Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n] Request Version: HTTP/1.1 Response Code: 302 HTTP chunked response Line-based text data: text/html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n <HTML><HEAD>\n <TITLE>302 Found</TITLE>\n </HEAD><BODY>\n <H1>Found</H1>\n The document has moved <A HREF="https://cp.freehostia.com/404/">here</A>.<P>\n <P>Additionally, a 302 Found\n error was encountered while trying to use an ErrorDocument to handle the request.\n <HR>\n <ADDRESS>Apache/1.3.33 Server at boredomsoft.org Port 80</ADDRESS>\n </BODY></HTML>\n Response with /errors/404.php specified in CPanel: Code: No. Time Source Destination Protocol Info Followed by:187 1.444362 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 302 Found HTTP/1.1 302 Found (text/html) Hypertext Transfer Protocol HTTP/1.1 302 Found\r\n [Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n] Request Version: HTTP/1.1 Response Code: 302 Location: /errors/404.php\r\n Hypertext Transfer Protocol HTTP/1.1 302 Found\r\n [Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n] Request Version: HTTP/1.1 Response Code: 302 HTTP chunked response Line-based text data: text/html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n <HTML><HEAD>\n <TITLE>302 Found</TITLE>\n </HEAD><BODY>\n <H1>Found</H1>\n The document has moved <A HREF="/errors/404.php">here</A>.<P>\n <P>Additionally, a 302 Found\n error was encountered while trying to use an ErrorDocument to handle the request.\n <HR>\n <ADDRESS>Apache/1.3.33 Server at boredomsoft.org Port 80</ADDRESS>\n </BODY></HTML>\n Code: No. Time Source Destination Protocol Info 196 1.487887 192.168.1.149 66.40.52.73 HTTP GET /errors/404.php HTTP/1.1 Hypertext Transfer Protocol GET /errors/404.php HTTP/1.1\r\n [Expert Info (Chat/Sequence): GET /errors/404.php HTTP/1.1\r\n] Request Method: GET Request URI: /errors/404.php Request Version: HTTP/1.1 And then: Code: No. Time Source Destination Protocol Info
295 2.011939 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 404 Not Found (text/html) Hypertext Transfer Protocol HTTP/1.1 404 Not Found\r\n [Expert Info (Chat/Sequence): HTTP/1.1 404 Not Found\r\n] Request Version: HTTP/1.1 Response Code: 404 Line-based text data: text/html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n <html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n <title>404</title>\n <link rel="stylesheet" href="errors.css" type="text/css" />\n </head>\n <body bgcolor="#64748B">\n </head>\n \n <body>\n <p> </p>\n <p> </p>\n <p> </p>\n <p> </p>\n <table width="918" border="0" align="center">\n <tr>\n <td width="156" rowspan="4" class="bodyText"><img src="exclaimation.gif" width="151" height="151" /></td>\n <td class="bodyText"><span class="style5">HTTP Error 404: Inept or ham-handed user </span></td>\n </tr>\n <tr>\n <td width="903" bgcolor="#FFFFFF" class="bodyText"><ol>\n <strong>Emptiness</strong>:\n [truncated] <li>The state of being empty; absence of contents; void space; vacuum; as, the emptiness of a vessel; emptiness of the stomach.</li><li>Want of solidity or substance; unsatisfactoriness; inability to satisfy desire; vac <li><strong>Want of knowledge; lack of sense; vacuity of mind</strong>.</li>\n </ol></p> </td>\n </tr>\n <tr>\n <td bgcolor="#FFFFFF" class="style5"><div align="center">the page you asked for does not exist in our space-time continuum </div></td>\n </tr>\n <tr>\n <td bgcolor="#999999"><p><a href="javascript:history.go(-1)">Go back</a>, thee, from whence thou came. And darken not this URL again. For if thou dost not heed my words, then thou dost have the brain of birds. Amen </p> </td>\n </tr>\n </table>\n <p align="center"><a href="http://www.boredomsoft.org">Go To Main Page </a></p>\n </body>\n </html>\n Conclusions: .htaccess is being ignored. The server looks only to the CPanel setting for an error document. This error document is served along with a 302 header rather than a 404 header. If the error document specified in CPanel contains the PHP code to send a 404 response, this response is sent only AFTER the 302 response is sent, and is therefore useless. HELP! |
Author: | vandersur [ Mon Apr 04, 2011 5:35 pm ] |
Post subject: | |
This problem still stays: .htaccess is being ignored. The server looks only to the CPanel setting for an error document. This error document is served along with a 302 header rather than a 404 header. |
Author: | mideschenes [ Mon Aug 01, 2011 1:41 am ] |
Post subject: | |
Same problem here : my .htaccess seems to be ignored and the server looks to the cpanel for the et Error 404 page setting... |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |