Nginx & SPDY error: net::ERR_SPDY_PROTOCOL_ERROR

Mattias Geniar, Wednesday, December 17, 2014 - last modified: Wednesday, August 12, 2015

I recently enabled SPDY on this blog, and once in a while I got the following "err_spdy_protocol_error" error in my browser, causing chunks of the page (javascript, CSS, ...) to stop loading.

The err_spdy_protocol_error error: what it looks like

You see the error in your browser like this.

net::ERR_SPDY_PROTOCOL_ERROR

In the Network Tab of your inspector, it looks like this.

err_spdy_protocol_error

That's not good, right.

Where does the err_spdy_protocol_error error come from?

The solution to the "err_spdy_protocol_error" problem turned out to be really simple, at least in this case, by just looking at the error logs produced by this vhost.

$ tail -f /var/www/site.be/logs/error.log
2014/12/18 00:15:01 [crit] 1041#0: *3 open() "/usr/local/nginx/fastcgi_temp/4/00/0000000004" failed (13: Permission denied) while reading upstream, client: 1.2.3.4, server: ma.ttias.be, request: "GET /page.php?..."

To enable SPDY I had upgraded my Nginx to the latest available 1.7.8, but in the process of that installation it seems some file permissions were incorrectly modified. For instance, the FastCGI cache -- the one that holds the responses for the PHP-FPM upstream -- were owned by user nobody, with only write permissions to the owner.

$ ls -alh /usr/local/nginx/fastcgi_temp
drwx------ 12 nobody root 4096 Feb 11  2012 fastcgi_temp

And as an obvious result, Nginx couldn't write to that cache directory. Modified the permissions to grant the user nginx write permissions, and all errors were gone.

$ chown nginx:nginx /usr/local/nginx/fastcgi_temp/ -R

And all SPDY protocol errors were gone. Conclusion? Check the errors logs when you implement a new protocol in the middle of the night.

If you get the err_spdy_protocol_error error as a user, and don't manage the site you're visiting, there isn't much you can do. The problem is with the server, so if you can't change that, you can't fix the err_spdy_protocol_error error. If you really want to visit that site, try another browser (one that doesn't support SPDY/HTTP2).



Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!

Comments

FJ Bakry Saturday, October 1, 2016 at 12:39 - Reply

Hi Matt,
I am experiencing the same thing. Chrome console shows errors varies like err_spdy_protocol_error, err_connection_closed, and err_connection_reset. I’ve checked error log on /var/log/nginx/error.log and /home/user/logs/error_log but I didn’t see any error logged there. The only error I see on /var/log/nginx/error.log is: “ssl_stapling” ignored, host not found in OCSP responder “ocsp.int-x3.letsencrypt.org/”
which I believe this is not the issue (got those error when I restart nginx service).

I use incognito tab to check and another weird issue is that static files are not loaded when they are loaded at the first time (getting some above errors) but then it’s loaded OK on second or third try.

I have searched for the solution for the last three days and nothing can solve this. Do you have any idea why I keep getting those issues?

Thanks in advance.

FJ


João Moreira Wednesday, July 26, 2017 at 18:32 - Reply

Hi Mattias,

I found you via your Podcast, congrats for that! ;)

And in the process i subscribed your NL…

I’m writing since i’m using nginx with HTTP2 with no issues, and i only get this error when enabling Content-Security-Policy HEADER.

Somehow that HEADER with HTTP2 don’t get along…

I’ll go dig now… =)

BR,
João Moreira


    João Moreira Wednesday, July 26, 2017 at 18:42 - Reply

    Again… =)

    add_header Content-Security-Policy: …

    The : is enough for “err_spdy_protocol_error”, despite nginx -t passed without errors.

    BR,
    JM


xkungfu Monday, August 7, 2017 at 19:35 - Reply

thank you very much!
I remove the error under your guidance!


Leave a Reply

Your email address will not be published. Required fields are marked *