Open andymathieson opened 5 years ago
Hi @andymathieson Can you post the whole config? You have posted the +debug, but this can´t show all the config directives.
Certainly. No problem.
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed Disallow "*/admin*";
pagespeed Disallow "*/backend*";
pagespeed Disallow "*/grappelli*";
pagespeed Disallow *fonts.css*;
# Honoring Content-Security-Policy Headers
pagespeed HonorCsp on;
# Lower-casing HTML element and attribute names
pagespeed LowercaseHtmlNames on;
# Pagespeed Header
pagespeed XHeaderValue "Powered By ngx_pagespeed";
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
pagespeed ImageResolutionLimitBytes 128000000;
pagespeed EnableFilters convert_to_webp_lossless;
pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters prioritize_critical_css;
pagespeed LoadFromFileCacheTtlMs 315360000000;
pagespeed LoadFromFile 'http://domain.co.uk/assets/' '/srv/www/domainglobal/master/domainglobal/public/';
pagespeed Domain 'https://domain.co.uk/assets';
pagespeed MapRewriteDomain 'https://cdn.cloudfront.net/assets' 'https://domain.co.uk/assets';
Hi @andymathieson
So thi´s is not working:
pagespeed MapRewriteDomain 'https://cdn.cloudfront.net/assets' 'https://domain.co.uk/assets
';
Well.. I´m not sure if this part work 'https://domain.co.uk/assets'
as far as in the doc don´t say that path are allowed in the original domain as is stated for destination.... But you say it works for other file types.... so thi´s make me thinking is a file extension issue or an html label.
The doc states "When PageSpeed rewrites a resource...." but svg files can´t be rewrited cause can´t be optimized/cache extended
At what html labels are the svg files set? img or picture?
EDIT: The content-type is set to image/svg+xml
?
Content type is as you stated and the files are in img tags. I know these files won't optimise but I just wanted to seve via cdn
And when you run with the +debug parameter, Have any message about these files?
<img src="/assets/my.svg" alt="my-alt-tag"/><!--The image was not inlined because you have chosen to only inline the critical images but this image is not critical.-->
Can you try to use absolute url like:
<img src="https://mydomain.com/assets/my.svg" alt="my-alt-tag"/>
The other images are relatives url too?
Hi @Lofesa . Sorry for the late reply. I've tried with and without the absolute url but to no avail.
All other images, css, js etc is served from /assets/file.ext
Just those svgs!
Hi @andymathieson So this make me thinking that as far as the svg files get totally untouched by pagespeed then don´t fire the filter to change the domain. For example pdf files are not optimized in any way but the cache extender, so, I think: never tried, for pdf files the change of domain may work.
EDIT: One more thing, Have you enabled the IPRO?
pagespeed InPlaceResourceOptimization on;
Hi guys,
I'm 99% there with our Pagespeed config file. Just the SVG file URLs don't map to the CDN. All other static files do, CSS, JS, webp, jpg etc but simply not the SVG's which we use quite a lot.