net::ERR_HTTP2_PROTOCOL_ERROR on "to-be" cached pages

I’ve seen people discuss this topic here, but most of them are unclear as to why this is happening on certain pages (it seemed to be related to the size of the affected pages). Some of the ones are marked resolved either because someone from Cloudflare had contacted the submitter or the submitter just used the proxied option instead of letting Cloudflare handle the traffic.

Is there anyone who actually knows why on some pages (in our case, it’s some book chapter page that has a lot of text on the pages), we get a (failed) status on the request when inspected, and in the console we see net::ERR_HTTP2_PROTOCOL_ERROR?

The page is cached upon the first visit, and we only get the error on the first visit. Subsequent visits can load the page just fine. If I use /etc/hosts or disable Cloudflare altogether, it doesn’t show the error at all, whether the page is cached or not.

I tried adding Page Rules or Caching rules to try and bypass the caching but that didn’t solve the issue.

I submitted a support request 2 weeks ago, and other than the canned response to tell us to submit the HAR file (which I had sent), I’ve heard nothing from the support people. I’m posting here in case somebody knows what’s actually going on. Is there a special header that I should present? or is there a Cloudflare configuration that I can try? or should we just stop using this?

Hi,

In my experience - this error has most commonly been caused by a malformed HTTP response headers (normally CSP -Content security policy headers) that have been not formatted correctly, and Chrome is strict in how it enforces the syntax of response headers, so when the syntax is incorrect it fails with this error.

Are you only seeing this in Chrome browser?

Unfortunately it is difficult to be advise further without doing some testing to see what we can see, if your able to share your domain name and I can take a look and see if I can see anything that stands out.

If not, this is a fantastic thread on slackoverflow that shows how someone worked through identifying this with Chrome net export - php - What's the net::ERR_HTTP2_PROTOCOL_ERROR about? - Stack Overflow

Hope this helps!

Hello @damien, thank you so much for your help. I was able to fix this issue by turning off the gzip settings on my end. Is Cloudflare gzip-ing the content by default? I suspect it was the same “double gzip” issue from the thread.

Hi @lucistrust

I believe this documentation answers your question.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.