rewriting external resources possible?

146 views
Skip to first unread message

shiz

unread,
Aug 1, 2015, 6:18:02 AM8/1/15
to ngx-pagespeed-discuss
Wondering it would be possible to minimize/combine/rewrite resources external to our website.

So far all attempts are failed.

e.g.

[Sat, 01 Aug 2015 10:08:37 GMT] [Info] [14334] No permission to rewrite 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'
[Sat, 01 Aug 2015 10:08:37 GMT] [Info] [14334] No permission to rewrite 'https://s3.amazonaws.com/cdn.leadbrite.com/leadplayer/r0032/js/leadplayer.js'
[Sat, 01 Aug 2015 10:08:37 GMT] [Info] [14334] No permission to rewrite 'https://pixel.quantserve.com/pixel/p-Cm4ca94qBgB04.gif'
[Sat, 01 Aug 2015 10:08:37 GMT] [Info] [14334] No permission to rewrite 'https://www.google.com/jsapi'

Jeff Kaufman

unread,
Aug 5, 2015, 10:58:33 AM8/5/15
to ngx-pagesp...@googlegroups.com
This is possible, with MapProxyDomain [1].  It will copy the files onto your server, optimize it, and then serve them from something like /ajax_googleapis_com/ajax/libs/jquery/1.7.2/jquery.min.js and /s3_amazonaws_com/cdn.leadbrite.com/leadplayer/.

I would actually expect this to slow down your site, though.  They're being served from CDNs and some of them may also be in cache from visiting other sites.  Moving them onto your domain breaks both of those.  Plus they're already minified, so the gain is smaller (just saving a connection startup).


--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at http://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

shiz

unread,
Aug 7, 2015, 4:35:14 PM8/7/15
to ngx-pagespeed-discuss
Oh! That's very interesting.  Thank you so much Jeff.  Exactly what I needed.

I reckon I used bad examples.  However there are a couple of directories with multiple images from external resources that I would like to rewrite using this feature.

I've tested it and so far it works.  However I can't find the files nowhere on my server.  Where are they?

e.g.

1st try : 


2nd try:


I've created /A1images and it remains empty?

Do I do something wrong?

I'm asking because if I get this to work, I'll have a CDN to pull those images and serve them.

You know I learn by example and there are none in the huge pagespeed documentation about those features.  So I'm asking questions.

Best regards.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

Jeff Kaufman

unread,
Aug 7, 2015, 4:54:17 PM8/7/15
to ngx-pagesp...@googlegroups.com
You won't find copies of the images stored under your server root: PageSpeed stores them in its cache.  This shouldn't be a problem with a pull-cdn though, and the directive you tried looks nearly right.  Perhaps try:


assuming cdn.mydom.com is a pull cdn where a request to cdn.mydom.com/foo/bar turns is pulled from www.mydom.com/foo/bar if not in cache.

Then PageSpeed will turn html like:


Into:


While serving them up at https://www.mydom.com/A1images/ as needed.

To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.

shiz

unread,
Aug 7, 2015, 5:38:32 PM8/7/15
to ngx-pagespeed-discuss
Oh, it's awesome.  Worked at first try.

Do I need to repeat the directives for http and https protocol?  Wildcards gave error in all my attempts

e.g.
What would be the proper way.  Mydom handles both http and https but some pages are forced either http OR https.
The external domain usually don't support SSL and the CDN handles both.

Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

Jeff Kaufman

unread,
Aug 10, 2015, 9:37:02 AM8/10/15
to ngx-pagesp...@googlegroups.com
Glad it's working!

Yes, I think you have to repeat your configurations for https and http.

This would be nice for us to fix.
>>>>> an email to ngx-pagespeed-di...@googlegroups.com.
>>>>> Visit this group at
>>>>> http://groups.google.com/group/ngx-pagespeed-discuss.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "ngx-pagespeed-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to ngx-pagespeed-di...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/ngx-pagespeed-discuss.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "ngx-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ngx-pagespeed-di...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages