#45818 [NEW]: Header location not work in 404 error page with Nginx

[email protected] ("macroz at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             macroz at gmail dot com
Operating system: cent os 5
PHP version:      5.2.6
PHP Bug Type:     Other web server
Bug description:  Header location not work in 404 error page with Nginx

Description:
------------
Code header(Location:url) in 404 error page not work with nginx.

My webserver is Nginx 0.7.10 + php-fastcgi 5.2.6

Nginx conf code: 

error_page  404  /404.php;

Code in 404.php:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.abc.com/");
?>


Curl -I a not exists file results (Nginx 0.7.10 + php-fastcgi 5.2.6)

curl -I http://www.abc.com/120.html
HTTP/1.1 404 Not Found
Server: nginx/0.7.10
Date: Thu, 14 Aug 2008 08:46:45 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.2.6
Location: http://www.abc.com/



This is work in apache+mod_php.
 
Curl -I a not exists file results (apache + mod_php)

curl -I http://www.abc.com/120.html
HTTP/1.1 301 Moved Permanently
Date: Thu, 14 Aug 2008 09:08:41 GMT
Server: Apache
X-Powered-By: PHP/5.2.5
location: http://www.abc.com/
Vary: Accept-Encoding
Connection: close
Content-Type: text/html



Reproduce code:
---------------
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.abc.com/");
?>

Expected result:
----------------
It will be location to http://www.abc.com/ when visite a not exist page.

Actual result:
--------------
Not location to http://www.abc.com/

-- 
Edit bug report at http://bugs.php.net/?id=45818&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45818&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45818&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45818&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45818&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45818&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45818&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45818&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45818&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45818&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45818&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45818&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45818&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45818&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45818&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45818&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45818&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45818&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45818&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45818&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45818&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.