Answer the question
In order to leave comments, you need to log in
Why empty Content-Type in nginx, php-fpm bundle?
Good afternoon!
Faced a problem with getting HTTP headers.
I am using nginx and php-fpm. The task was to get an additional header and check it.
Used the alternative getallheaders function:
if (!function_exists('getallheaders'))
{
function getallheaders()
{
$headers = '';
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
try_files $uri =404;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param HTTP_HOST $host;
fastcgi_param HTTP_CONTENT_TYPE $content_type;
fastcgi_param HTTP_CONTENT_HMAC $http_content_hmac;
access_log /var/log/nginx/postdata.log main_post;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question