incubator-pagespeed-ngx icon indicating copy to clipboard operation
incubator-pagespeed-ngx copied to clipboard

Error: Resource based on <image.jpg> but cannot access the original

Open zeldi-dev opened this issue 6 years ago • 4 comments
trafficstars

We have an nginx as a caching proxy server in front of apache server. All the static content is served by nginx, php files are forwarded to apache.

In our message_history we are getting lots of intermittent errors of type: [xlogo-small.png:0] Resource based on https://www.hostname.com/docs/img/logo-small.png but cannot access the original

These errors occur randomly on random files (the example above is a regular static image).

Relevant nginx/pagespeed config:

    location ^~ /docs/ {
            try_files $uri @not_found;
            expires 366d;
            add_header Pragma public;
            add_header Cache-Control "public";
    }
    location @not_found {
            return 404;
    }

    pagespeed Domain https://*.hostname.*;
    pagespeed MapOriginDomain https://127.0.0.1 https://*.hostname.*;

Thank you for your help.

zeldi-dev avatar Apr 25 '19 22:04 zeldi-dev

Hi Almost you need to enable https fecht. pagespeed FetchHttps enable; pagespeed SslCertDirectory directory; pagespeed SslCertFile file;

Lofesa avatar Apr 28 '19 07:04 Lofesa

@Lofesa, thank you for your hint. I did change the configuration as suggested, but at first the same problems were still present. I did turn around the whole configuration now, made it much simpler for testing purposes and I will see now, currently, 12 hours have passed without a warning so far.

I will report the working configuration.

zeldi-dev avatar Apr 30 '19 07:04 zeldi-dev

@zevnikrok I have the exact same issue.

How did you solve it?

EliezerB123 avatar Aug 26 '20 17:08 EliezerB123

uf..., so much for promising to post working configuration :)

This is our production version, working acceptable ok, google still makes lots of suggestions, and it doesn't rate page really well. Keep in mind we have multiple hosts, which serve almost the same content: www.host.com, w2.host.com, www.host.eu, www.host.fr ...

pagespeed on; pagespeed Domain https://.host.; pagespeed MapOriginDomain https://www.host.com https://.host.;

pagespeed FileCachePath /var/ngx_pagespeed_cache; pagespeed ListOutstandingUrlsOnError on;

pagespeed RewriteLevel PassThrough; pagespeed EnableFilters inline_images,recompress_images,convert_to_webp_lossless,resize_rendered_image_dimensions,resize_images,responsive_images,responsive_images_zoom,lazyload_images,rewrite_css,prioritize_critical_css,combine_css,add_head,fallback_rewrite_css_urls,rewrite_css,flatten_css_imports,inline_css,rewrite_style_attributes,inline_import_to_link,convert_meta_tags,rewrite_javascript,inline_javascript; pagespeed ImagePreserveURLs on;

pagespeed Statistics on; pagespeed StatisticsLogging on; pagespeed LogDir /var/log/pagespeed; pagespeed MessageBufferSize 1000000; pagespeed EnableCachePurge on;

pagespeed FetchHttps enable,allow_unknown_certificate_authority; pagespeed SslCertDirectory /etc/pki/tls/certs; pagespeed SslCertFile /etc/pki/tls/cert.pem;

I hope it helps

zeldi-dev avatar Aug 26 '20 20:08 zeldi-dev