简体   繁体   中英

php header location auto set http_response_code to 302 when it is 200 with php-fpm and nginx?

code like:

<?php
header('Location: http://www.google.com', TRUE, 200);

when run it in apache+php, the http_response_code is 200, but when run it in nginx + php-fpm, the http_response_code is 302.

what happens in nginx + php-fpm?

after read the source code of nginx, i found in /src/http/modules/ngx_http_fastcgi_module.c, line 1564, there are some code about set status code to 302.

header('Location: http://www.google.com', TRUE, 200);

the response code 200 will not pass to nginx by fpm, so the response code will set to 302

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM