Question

mod_pagespeed rewrites my css links from

link href="/css/file.css" rel="stylesheet"

to something like:

link href="http://example.com/css/file.css.pagespeed.ce.97987.css" rel="stylesheet"

The problem is that if file.css.pagespeed.ce.97987.css hasn't been created in the pagespeed cache by one of the servers behind the load balancer it may not be found.

It does the same thing with .js files and images

Is it possible to access these files on the local server rather than asking the load balancer to serve them?

EDIT:

This has been solved by:

ModPagespeedEnableFilters trim_urls

Which rewrites to

link href="/css/file.css.pagespeed.ce.97987.css" rel="stylesheet"

EDIT 2:

This rewrote the hrefs in the a links and stripped out the base url from those, which isn't good since I want them to redirect to the load balancer

Était-ce utile?

La solution

if you don't have any directory rewrite rules in your .htaccess you can create a stickiness policy. this means that the elb holds a tcp connection to one instance of the scaling group for a defined time. further you have to add the stickiness policy to the listeners.

Autres conseils

I'm exploring the same. I think using "ModPagespeedMapOriginDomain" to map your local server IP to your load balanced domain or IP will tell modpagespeed to reference the locally cached files on each server. This means your pagespeed.conf would need to be unique on each server.

Example:

ModPagespeedMapOriginDomain localhost <domain>
ModPagespeedMapOriginDomain localhost https://<domain>

or with IP:

ModPagespeedMapOriginDomain x.x.x.x <domain>
ModPagespeedMapOriginDomain x.x.x.x https://<domain>

or using Virutal Hosts:

ModPagespeedMapOriginDomain x.x.x.x/virutalhostroot <domain>
ModPagespeedMapOriginDomain x.x.x.x/virutalhostroot https://<domain>

SSL is only setup for primary VHost in my case

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top