Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Don't update Last-Modified when cache-extending #1085

Description

@stevemayhew

When fetching a local resource, pagespeed is adding a Last-Modifed header. This breaks extend-cache function completely

[ec2-user@ip-172-31-6-55 ~]$ curl -s -D - http://localhost/assets/tve/common/js/utils/i18n_manager.js  -o /dev/null 
HTTP/1.1 200 OK
Date: Tue, 26 May 2015 19:45:00 GMT
Server: Apache
Last-Modified: Thu, 14 May 2015 12:01:20 GMT
Accept-Ranges: bytes
Content-Length: 3404
Works: abc
Cache-control: public, max-age=600
Content-Type: text/javascript

[ec2-user@ip-172-31-6-55 ~]$ curl -s -D - http://localhost/assets/tve/common/js/utils/i18n_manager.js  -o /dev/null 
HTTP/1.1 200 OK
Date: Tue, 26 May 2015 19:45:04 GMT
Server: Apache
Content-Length: 3404
Accept-Ranges: bytes
Works: abc
Cache-control: public, max-age=600
Etag: W/"PSA-D7c4hwVIR0"
Last-Modified: Tue, 26 May 2015 19:45:04 GMT
X-Content-Type-Options: nosniff
Content-Type: text/javascript

[ec2-user@ip-172-31-6-55 ~]$ curl -s -D - http://localhost/assets/tve/common/js/utils/i18n_manager.js  -o /dev/null 
HTTP/1.1 200 OK
Date: Tue, 26 May 2015 19:45:09 GMT
Server: Apache
Content-Length: 3404
Accept-Ranges: bytes
Works: abc
Cache-control: public, max-age=600
Etag: W/"PSA-D7c4hwVIR0"
Last-Modified: Tue, 26 May 2015 19:45:09 GMT
X-Content-Type-Options: nosniff
Content-Type: text/javascript

As you can see from the last 2 curl's that pagespeed added a Last-Modified header with date/time as now (it keeps changing)

This faithfully is forwarded along to the service of the hashed file

[ec2-user@ip-172-31-6-55 ~]$ curl -s -D - http://localhost/assets/tve/common/js/utils/i18n_manager.js.pagespeed.ce.D7c4hwVIR0.js  -o /dev/null 
HTTP/1.1 200 OK
Date: Tue, 26 May 2015 19:47:06 GMT
Server: Apache
Accept-Ranges: bytes
Works: abc
Expires: Wed, 25 May 2016 19:47:06 GMT
Cache-Control: max-age=31536000
Etag: W/"0"
Last-Modified: Tue, 26 May 2015 19:47:06 GMT
Content-Length: 3404
Vary: Accept-Encoding
Content-Type: text/javascript

[ec2-user@ip-172-31-6-55 ~]$ curl -s -D - http://localhost/assets/tve/common/js/utils/i18n_manager.js.pagespeed.ce.D7c4hwVIR0.js  -o /dev/null 
HTTP/1.1 200 OK
Date: Tue, 26 May 2015 19:47:08 GMT
Server: Apache
Accept-Ranges: bytes
Works: abc
Expires: Wed, 25 May 2016 19:47:08 GMT
Cache-Control: max-age=31536000
Etag: W/"0"
Last-Modified: Tue, 26 May 2015 19:47:08 GMT
Content-Length: 3404
Vary: Accept-Encoding
Content-Type: text/javascript

Thus rendering the Expires useless.

Looks like it is re-writing the cache file each time a request is made to the hashed URL:

[ec2-user@ip-172-31-6-55 ~]$ ls -l /var/cache/mod_pagespeed/rname/ce_FKCogvqqf3LdXAitqK4V/http,3A/,2Flocalhost/assets/tve/common/js/utils/i18n_manager.js,40,40_,
-rw------- 1 webapp webapp 123 May 26 19:51 /var/cache/mod_pagespeed/rname/ce_FKCogvqqf3LdXAitqK4V/http,3A/,2Flocalhost/assets/tve/common/js/utils/i18n_manager.js,40,40_,

[ec2-user@ip-172-31-6-55 ~]$ ls -l /var/cache/mod_pagespeed/rname/ce_FKCogvqqf3LdXAitqK4V/http,3A/,2Flocalhost/assets/tve/common/js/utils/i18n_manager.js,40,40_,
-rw------- 1 webapp webapp 123 May 26 19:52 /var/cache/mod_pagespeed/rname/ce_FKCogvqqf3LdXAitqK4V/http,3A/,2Flocalhost/assets/tve/common/js/utils/i18n_manager.js,40,40_,

It would be best of PageSpeed completely ignored Last-Modified and relied on the shasum of the file for a check period.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions