incubator-pagespeed-mod
incubator-pagespeed-mod copied to clipboard
Headers removed when the response body is empty
We have an Ajax request that is just supposed to set a cookie in the response (i.e. a Set-Cookie header). However, if the response body is empty, mod_pagespeed filters this header (and others) from the response. Disabling mod_pagespeed OR setting something in the response content (even if it's just 1 character) fixes this.
We use the latest beta version.
Thanks for the report.
What content-type is it? Also is it a 200 or a 204?
Here's some info (when it's going wrong):
Request Method:GET Status Code:200 OK Cache-Control:max-age=0, no-cache Connection:close Content-Encoding:gzip Content-Length:20 Content-Type:text/html; charset=UTF-8 Server:Apache Vary:Accept-Encoding
Note that even without any filter applied (i.e. PassThrough) this behaviour occurs.
In the correct case (e.g. when setting the response body to '1'), it looks like this instead:
Request Method:GET Status Code:200 OK Cache-Control:max-age=0, no-cache Connection:close Content-Encoding:gzip Content-Length:21 Content-Type:text/html; charset=UTF-8 Server:Apache Set-Cookie:... Vary:Accept-Encoding X-Mod-Pagespeed:1.10.33.2-7599
I am kind of confused by the Content-Length: 20 here. Or is the payload an empty gzip'd or such?
I've noticed it too. Seems an old bug in mod_deflate (see https://bz.apache.org/bugzilla/show_bug.cgi?id=51350). I'm on CentOS, so stuck with Apache 2.2.15 though.
Hmm, can't seem to reproduce by replaying with mod_asis (minus the gzip'ing).
This still appears to be an issue on Apache 2.4.29 / Pagespeed 1.13.35.2-0. I’ll try to find time to test 1.14.36.1 soon