-
Notifications
You must be signed in to change notification settings - Fork 155
IPRO turns application/json
into application/javascript
#1321
Comments
You could add Alternatively you could also exclude any urls that result in json responses by disallowing them: |
Hi, Thank you for this fast answer. But it doesn't explain why for some (majority) json responses I get Ps: I have no way to add no-transform to the server REST API, and it can affects a lot of uris (All our REST API) Regards |
What page(s) are you getting the application/javascript header instead of On Tue, Jun 21, 2016 at 4:14 AM, laborima [email protected] wrote:
|
Hi, It happen 100% of the time for this url: And never for this url: Both url return same header from server without pagespeed. With pagespeed content-type is different for the first one. Regards |
rewritten json resources get the can you share the headers from the one that doesn't get the |
If you look more deeper in the file https://github.com/pagespeed/mod_pagespeed/blob/master/pagespeed/kernel/http/content_type.cc#L71 it returns also application/json We are using YUI2 as javascript library which doesn't recognize application/javascript as json but as text. Both headers are the same: Without pagespeed : Cache-Control: max-age=3600 Pagespeed should'nt transform original content-type. It wasn't the case in the previous stable release of pagespeed. Regards |
Testing locally with Regardless, this is a bug, and we should minify |
application/json
into application/javascript
We have |
Talking to someone in security here, serving json as |
Looking at our http cache, we are recording the input resource as |
We're recording the output resource as |
It looks like all we need to do to fix this is to fix Writing a test for this, though, I'm running into a problem where at least in our current setup we don't optimize json in nginx. |
|
and then again when called from the body filter instead of the check header filter:
and when called from the body filter:
|
Instead of something keyed to content type, I wonder if PSOL is responding to the missing cache-control header? But it would be really weird for a missing cache-control header to make us not write the content-type to the the http cache. |
I don't see anything in ngx_pagespeed's |
I wonder if this is the same |
It's not that issue: logging response headers at the beginning and end of |
The difference in caching comes from |
If I mark This all makes sense now: in Apache both the js file and the json file have explicitly configured cache control headers, for 600s, while in Nginx they don't. Because js is heuristically cacheable this isn't a problem, and we can still ipro it, but because json isn't then ipro can't happen. I should fix this by setting explicit caching headers in our Nginx test config to mirror Apache's. (Niggling question: why are the headers we write to the input resource cache for the json file missing the content type?) |
mod-pagespeed-stable 1.11.33.2-r0 under apache
Since the last update of pagespeed using default options Ajax Json call gives
Without pagespeed :
With pagespeed:
Notice the
Content-Type: application/javascript; charset=UTF-8
which break our Ajax call. Haven't find any way to disabled it. The server full json response.columns.txt
Regards
The text was updated successfully, but these errors were encountered: