2
votes

I've been having a problem since i installed mod_pagespeed across our LAMP servers and i can't seem to find an answer to it

Set-up:

  • Load balancer across 4 LAMP servers
  • Mixture of http and https pages
  • Product images are shared amongst the servers through a mounted disk (/mnt/media_images/)
  • Apache Alias set up:
    Alias /images/media /mnt/media_images
    (i.e. www.example.com/images/media/test.jpg located on the server at /mnt/media_images/test.jpg)
  • mod_pagespeed installed on all servers with exact same config:
    ModPagespeed on
    ModPagespeedRespectXForwardedProto on
    ModPagespeedMapOriginDomain "http://localhost" "http://www.example.com"
    ModPagespeedMapOriginDomain "http://localhost" "https://www.example.com"
    ModPagespeedMaxInlinedPreviewImagesIndex 20
    ModPagespeedEnableFilters remove_comments,collapse_whitespace,combine_javascript,insert_dns_prefetch,defer_javascript,insert_image_dimensions,lazyload_images

The Problem:

mod_pagespeed optimises all images on http fine, rewriting filenames and fetching them no problem, i.e.:

On https all non-product images work fine just like on http, i.e.:

...but the product images don't work. The filenames are re-written, but visiting these rewritten filenames return 404s. If you take the rewritten filename and simply change https:// to http:// the image is then returned.

I've tested it on a non load-balanced set up and that seemed to work, so the problem seems to be the combination of a load-balancer with https and an alias pointing to the mounted disk.

Any help or suggestions would be greatly appreciated

1

1 Answers

0
votes

In the cases as running an instance behind a load balancer then it better to use

ModPagespeedMapOriginDomain origin_to_fetch_from origin_specified_in_html

Code that restrictions in the sites available conf file for the apache2 and give it a try.