Apache mod_spdy - SPDY Protocol Support for Apache

Posted:   |  More posts about Linux Apache

I was procrastinating and running out of things to do when I saw the news item saying that there was a thing called mod_spdy for Apache.

SPDY (pronounced "SPeeDY") is a protocol which browsers can implement. SPDY augments HTTP. From Google's website:

  • SPDY allows client and server to compress request and response headers, which cuts down on bandwidth usage when the similar headers (e.g. cookies) are sent over and over for multiple requests.
  • SPDY allows multiple, simultaneously multiplexed requests over a single connection, saving on round trips between client and server, and preventing low-priority resources from blocking higher-priority requests.
  • SPDY allows the server to actively push resources to the client that it knows the client will need (e.g. JavaScript and CSS files) without waiting for the client to request them, allowing the server to make efficient use of unutilized bandwidth.

Sounds cool, but is it worth the trouble? I'd say yes, because it wasn't really any trouble to install!

Follow the instructions over at https://developers.google.com/speed/spdy/mod_spdy/. You should also note that the RPM or Deb you install will also add a repo for SPDY to your systems. I run an EL6 based system and I was worried to read on the mailing list:

"The rpm packages were built
on CentOS 5.4, so they should work on CentOS 5 or 6.  (The deb
packages were built on Ubuntu 8.04 LTS.)
" - Google Groups

But I'll just have to keep an eye out for when SPDY makes it into RPMFusion or EPEL includes SPDY with real packaging standards.

I did come across a quite annoying problem which I initially thought was a fault with RoundCube webmail.

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

However the problem turned out to be that I had a redirect rule in my Roundcube virtualhost config for port 80 *and* port 443 to rewrite to HTTPS if not HTTPS... Which was unncessary before SPDY but broke things when I put in SPDY. (SPDY does not identify as HTTPS? Not a great surprise.)

Edit: I have confirmed another breakage in Roundcube which this time is a problem with spdy. When a PHP application running through mod_php does both a POST and a request simultaneously, mod_spdy gets interrupted. Roundcube's UI is very AJAX heavy and so it easily encounters this issue.

Fixing the spdy + mod_php + AJAX issue is fairly easy if you don't mind running fastcgi for the particular application you're having trouble with. Just install it, make sure it is enabled/configured in Apache (automagically done on EL type distros) and put the following snippet in the Apache config for the virtualhost or optionally just for the location under which the application sits (modifying accordingly).

<Location />
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/bin/php-cgi .php

SPDY is turned on in Chrome/Chromium and Android (not sure which versions) by default. SPDY is available in Firefox 11. Go to "about:config" and search for spdy and then set network.http.spdy.enabled to True.

Comments powered by Disqus
Contents © 2013 Daniel Devine - Nikola Powered - Flattr Me! Flattr this Source