redirect_status上的奇数值(44)

时间:2014-03-05 15:02:52

标签: php apache .htaccess mod-rewrite redirect

  1. $_SERVER['REDIRECT_STATUS']的{​​{1}}是什么意思?
  2. 为什么'44'会有$_SERVER['REDIRECT_URL']值?
  3. 我没有使用mod_rewrite进行外部重定向,但是"/500.shtml"有两个不同的REQUEST_METHOD值(POST然后是GET);就像我发出 POST 请求然后被重定向为 GET 请求一样。这里发生了什么事?
  4. 我使用http://blog.iosart.com/2004/05/26/fooling-apache/中描述的方法根据$_SERVER值设置一些环境变量,然后在多个PHP应用程序之间进行多路复用。

    在使用%{HTTP_HOST} POST请求搜索错误时,我发现PHP从Superglobals获取这些值:

    multipart/form-data

    我的(简化).htaccess是:

    $_SERVER=array
    (
        'CONTENT_LENGTH' => '1660'
        'CONTENT_TYPE' => 'multipart/form-data; boundary=----------------------------7e789ef7ac774b7689c602d8f67446dd'
        'CONTEXT_DOCUMENT_ROOT' => '/home/myphpapp/public_html'
        'CONTEXT_PREFIX' => ''
        'DOCUMENT_ROOT' => '/home/myphpapp/public_html'
        'GATEWAY_INTERFACE' => 'CGI/1.1'
        'HTTP_ACCEPT' => '*/*'
        'HTTP_ACCEPT_ENCODING' => 'gzip, deflate'
        'HTTP_CONNECTION' => 'keep-alive'
        'HTTP_HOST' => 'api.myphpapp.com'
        'HTTP_USER_AGENT' => 'Dalvik/1.6.0 (Linux; U; Android 4.4.2; Android SDK built for x86 Build/KK)'
        'HTTP_X_TOKEN' => 'prod'
        'MY_HTTP_HOST' => 'api.myphpapp.com'
        'PATH' => '/bin:/usr/bin'
        'QUERY_STRING' => ''
        'REDIRECT_MY_HTTP_HOST' => 'api.myphpapp.com'
        'REDIRECT_REDIRECT_REQUEST_METHOD' => 'POST'
        'REDIRECT_REDIRECT_STATUS' => '44'
        'REDIRECT_REDIRECT_UNIQUE_ID' => 'UxZd4zIcVQUAAFwqGD8AAAAG'
        'REDIRECT_STATUS' => '44'
        'REDIRECT_UNIQUE_ID' => 'UxZd4zIcVQUAAFwqGD8AAAAG'
        'REDIRECT_URL' => '/500.shtml'
        'REDIRECT_APP_SET' => 'api'
        'REDIRECT_APP_MODE' => 'production'
        'REMOTE_ADDR' => '100.101.102.103'
        'REMOTE_PORT' => '65446'
        'REQUEST_METHOD' => 'GET'
        'REQUEST_SCHEME' => 'http'
        'REQUEST_URI' => '/v1/2/controller/action'
        'SCRIPT_FILENAME' => '/home/myphpapp/public_html/index.php'
        'SCRIPT_NAME' => '/index.php'
        'SERVER_ADDR' => '50.51.52.53'
        'SERVER_ADMIN' => 'webmaster@myphpapp.com'
        'SERVER_NAME' => 'api.myphpapp.com'
        'SERVER_PORT' => '80'
        'SERVER_PROTOCOL' => 'HTTP/1.1'
        'SERVER_SIGNATURE' => ''
        'SERVER_SOFTWARE' => 'Apache'
        'UNIQUE_ID' => 'UxZd4zIcVQUAAFwqGD8AAAAG'
        'APP_SET' => 'api'
        'APP_MODE' => 'production'
        'PHP_SELF' => '/index.php'
        'REQUEST_TIME_FLOAT' => 1393974756.09
        'REQUEST_TIME' => 1393974756
        'argv' => array()
        'argc' => 0
    )
    

    我正在运行Apache 2.4.7& PHP 5.4.25& index.php是Yii 1.1.14 App

1 个答案:

答案 0 :(得分:1)

我正在使用的http库中有一个错误。

以multipart POST结尾的边界有一个额外的CRLF,Content-Length比它应该大2个字节...这就是为什么Apache 2.4.7发送了500个响应并且php全局$ _SERVER的所有元素都有垃圾在里面..

在这种特殊情况下,Apache 2.4.3似乎忽略了额外的CRLF和错误的Content-Length。