New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModPagespeedLoadFromFile doesn't set the Content-Type correctly when query params exist #405

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 5 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter

GoogleCodeExporter commented Apr 6, 2015

In r1231 (ref issue 357), ModPagespeedLoadFromFile started stripping query 
params from the resource name before loading it. However, it seems that the 
query string params are still affecting the output in that they aren't stripped 
before determining the content type of certain resources. I'm seeing a lot of 
these in my log:


[Thu Mar 29 13:45:03 2012] [error] [mod_pagespeed 0.10.21.2-1381 @6876] Loaded 
resource with no Content-Type 
http://mysite.com/wp-includes/js/thickbox/thickbox.css?ver=20111117


It causes problems because that rewritten stylesheet is then served with a 
text/plain Content-Type header, effectively rendering it useless the first time 
it's served. Subsequent requests to that same resource load the mod_pagespeed- 
processed and cached resource, which then has the correct content type. 
Removing the ModPagespeedLoadFromFile directive and making mod_pagespeed fetch 
the file over HTTP resolves that issue.

The fix is to strip query params from the file name before determining the 
content type that's served for the not-yet-processed resource in the initial 
hit.

Original issue reported on code.google.com by amat...@gmail.com on 29 Mar 2012 at 8:54

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

To clarify, I believe this is only a problem when the rewrite deadline is 
exceeded. That can happen, for example, when a CSS file contains a ton of 
images in it and mod_pagespeed has to process / inline them all. If the CSS is 
processed within that deadline, it seems the correct content type is returned 
in spite of the logged error.

Original comment by amat...@gmail.com on 30 Mar 2012 at 5:27

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Aha, I can see how this is a problem.

When loading from file, we can only guess the file type based upon the 
extension and we are not correctly ignoring the query for this situation.

Looks easy to fix. I'm working on it now.

Thanks for the report.

Original comment by sligocki@google.com on 30 Mar 2012 at 5:35

  • Changed state: Accepted
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

This issue was closed by revision r1494.

Original comment by sligocki@google.com on 30 Mar 2012 at 10:00

  • Changed state: Fixed
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Original comment by sligocki@google.com on 30 Mar 2012 at 10:01

  • Added labels: release-note
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Original comment by jmara...@google.com on 22 May 2012 at 7:56

  • Added labels: Milestone-v22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment