Enabling and testing SPDY support on Nginx
Frederic Cambus December 12, 2013 [Nginx]Since Nginx now supports the SPDY protocol (ngx_http_spdy_module appeared in Nginx 1.3.15), I decided to enable it on statdns.net, an SSL only site. Indeed, SPDY requires the use of SSL/TLS and cannot operate under plain HTTP.
Enabling SPDY is pretty straightforward, all we need to do is to add the spdy parameter in the listen directives:
listen 443 ssl spdy;
listen [::]:443 ipv6only=on ssl spdy;
Header compression level is customizable using the spdy_headers_comp directive, for example:
spdy_headers_comp 1;
Check the SPDY module documentation for more details.
We can now test if SPDY is correctly enabled by displaying SPDY related embedded variables using the ngx_echo module:
location /spdy {
echo $spdy;
echo $spdy_request_priority;
}
Accessing the /spdy URL endpoint using a SPDY enabled browser should display the protocol version (SPDY/2 at the time of writing) along with the request priority.
When accessing the URL using Firefox, the following values are displayed:
2
1
When accessing the URL using Chrome, the following values are displayed:
2
0
According to the protocol drafts, stream priority in SPDY/2 ranges from 0 (lowest priority) to 3 (highest priority), whereas in SPDY/3 it ranges from 0 (highest priority) to 7 (lowest priority).