MapProxyDomain Extending Cache of proxied resources

Skip to first unread message

George Chanturidze

Mar 2, 2020, 8:22:44 PM3/2/20
to ngx-pagespeed-discuss
I'm trying to use MapProxyDomain to optimize external resources, mostly javascript.

I would like to do the following:
  1. extend browser cache lifetime (max-age)
  2. add a new hash to the resource URL with each update (so browser uses the updated file)
But simply using MapProxyDomain with extend_cache and rewrite_javascript filters does not do this. 

Can someone suggest if this is possible? I'm assuming in order to add a URL hash I would have to serve the resource from the target domain as well.

Here's my nginx.conf:

user www-data;

worker_processes auto;

pid /run/;

include /etc/nginx/modules-enabled/*.conf;

events {

        worker_connections 768;

        # multi_accept on;


http {


        # Basic Settings


        sendfile on;

        tcp_nopush on;

        tcp_nodelay on;

        keepalive_timeout 65;

        types_hash_max_size 2048;

        # server_tokens off;

        # server_names_hash_bucket_size 64;

        # server_name_in_redirect off;

        include /etc/nginx/mime.types;

        default_type application/octet-stream;

        pagespeed on;

        # Needs to exist and be writable by nginx.  Use tmpfs for best performance.

        pagespeed FileCachePath /var/ngx_pagespeed_cache;

        pagespeed MapProxyDomain;

        pagespeed RewriteLevel PassThrough;

        pagespeed EnableFilters extend_cache,rewrite_css,rewrite_javascript,hint_resource_preloading,local_storage_cache,responsive_images,rewrite_images,lazyload_images,inline_preview_images,resize_images,resize_mobile_images,remove_comments,collapse_whitespace,extend_cache,insert_dns_prefetch,in_place_optimize_for_browser,remove_comments;

        pagespeed MinImageSizeLowResolutionBytes 10000;

        pagespeed InPlaceRewriteDeadlineMs 50;

        pagespeed PrivateNotVaryForIE off;

        pagespeed CriticalImagesBeaconEnabled false;

        #       pagespeed LazyloadImagesAfterOnload off;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE

        ssl_prefer_server_ciphers on;


        # Logging Settings


        access_log /var/log/nginx/access.log;

        error_log /var/log/nginx/error.log;


        # Gzip Settings


        gzip on;

        gzip_vary on;

        gzip_proxied any;

        gzip_comp_level 6;

        gzip_buffers 16 8k;

        gzip_http_version 1.1;

        gzip_types text/plain text/css text/javascript text/xml application/javascript application/x-javascript application/xml application/xml+rss image/x-icon image/svg+xml image/jpeg image/jpg image/png application/json application/x-font-ttf application/x-font-opentype application/ application/font-sfnt application/font-woff font/woff2 application/font-woff2


        # Virtual Host Configs


        include /etc/nginx/conf.d/*.conf;

        include /etc/nginx/sites-enabled/*;



Mar 3, 2020, 4:06:29 AM3/3/20
to ngx-pagespeed-discuss

What you get when debug?

This put debug messages in the html code.
Maybe the analytics.js can´t be rewrited.
Reply all
Reply to author
0 new messages