Cache-Control being overwritten for application/json types

61 views
Skip to first unread message

Ryan S.

unread,
Feb 16, 2016, 5:12:00 PM2/16/16
to mod-pagespeed-discuss
I have some web services that return JSON data with the Content-type of application/json.  PageSpeed is overwriting the Cache-Control headers I send even with 

ModPagespeedModifyCachingHeaders off

It is always sending:

  1. Cache-Control:
    max-age=0, no-cache
While also killing my gzipping.  

The response headers before PageSpeed are:
  1. Connection:
    Keep-Alive
  2. Content-Encoding:
    gzip
  3. Content-Length:
    700
  4. Content-Type:
    application/json
  5. Date:
    Tue, 16 Feb 2016 22:09:57 GMT
  6. Expires:
    Tue, 16 Feb 2016 23:09:57 GMT
  7. Keep-Alive:
    timeout=2, max=1000
  8. Server:
    Apache
  9. ServerID:
    php-dev01
  10. Vary:
    Accept-Encoding

The headers after are:
  1. Cache-Control:
    max-age=0, no-cache
  2. Connection:
    Keep-Alive
  3. Content-Length:
    5574
  4. Content-Type:
    application/json
  5. Date:
    Tue, 16 Feb 2016 22:10:24 GMT
  6. Etag:
    W/"PSA-Xgxb1zUWTX"
  7. Expires:
    Tue, 16 Feb 2016 23:03:43 GMT
  8. Keep-Alive:
    timeout=2, max=999
  9. Server:
    Apache
  10. ServerID:
    php-dev02
  11. Vary:
    Accept-Encoding
  12. X-Content-Type-Options:
    nosniff
I am on the latest version and have tried everything I can think of to fix the Cache-Control and Content-Encoding.

Please help. Thanks!

Otto van der Schaaf

unread,
Feb 17, 2016, 7:11:59 AM2/17/16
to mod-pagespeed-discuss
Could you file an issue for this at https://github.com/pagespeed/mod_pagespeed/issues ?

You could work around the problem by disallowing optimization for this resource, see https://developers.google.com/speed/pagespeed/module/restricting_urls#disallow

Otto

Ryan S.

unread,
Feb 17, 2016, 2:13:21 PM2/17/16
to mod-pagespeed-discuss
Thanks.  I filed an issue.
Reply all
Reply to author
Forward
0 new messages