Opened 9 years ago

Closed 9 years ago

#802 closed defect (duplicate)

$server_protocol is empty with the HTTP/2.0 module

Reported by: jerrygrey@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.9.x
Keywords: protocol http2 FastCGI Cc:
uname -a: Linux homer 2.6.32-573.3.1.el6.x86_64 #1 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.9.5
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --without-http_memcached_module --with-http_ssl_module --with-http_v2_module --with-ipv6 --without-http_browser_module --without-http_empty_gif_module --without-http_limit_conn_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_uwsgi_module --without-http_scgi_module


It seems when using the new HTTP/2.0 module nginx no longer sets the $server_protocol correctly. It should be "HTTP/2.0", but when it is passed to FastCGI via "fastcgi_param", it shows up as an empty string.

var_dump() of $_SERVER shows:

  string(0) ""

when it should be:

  string(8) "HTTP/2.0"

This is important as it is best practice to use this value in PHP to set HTTP response status, for example:

<?php header($_SERVER['SERVER_PROTOCOL'].' 401 Unauthorized'); ?>

Which the result is " 401 Unauthorized", which is invalid and is ignored.

Change History (1)

comment:1 by Maxim Dounin, 9 years ago

Resolution: duplicate
Status: newclosed

Duplicate, see ticket #800.

Note: See TracTickets for help on using tickets.