Nginx proxy for Google URLs in WordPress

I wrote a script how to make not bring down the load speed of WordPress for visitors from China.
Here is the link: Google Font Api Proxy for WordPress
To use this proxy, I have to edit themes’ files even the script-loader.php by WordPress, that’s a disaster for upgrading.

Another problem is, I have SSL enabled on my blog. Every time I visit my blog, Chrome notices me that

The page at ‘’ was loaded over HTTPS, but displayed insecure content from ‘/p/’: this content should also be loaded over HTTPS.

The SSL green lock icon in the address bar is always be ‘warned’.

The new solution is using nginx’s substitution modules.
My blog is running on a Ubuntu 13.10, nginx 1.41, config options are below:

At the very beginning, I tried ‘ngx_http_sub_module‘, but only one sub_filter can be used in each directive, and regexp is not supported.

Then comes ngx_http_substitutions_filter_module, another nginx module and a better choice.

First, set up two proxy location for and, turn off Accept-Encoding to disable compression.
Then, set subs_filter_types to support text/css.
At last, write regex substitutions, with gr flags on.

Following configurations are added to the end of my server{} directive.

If you have cache plugin like ‘WP Super Cache’, make sure you have turned compression off in the plugin setting pages.
For ‘WP Super Cache’, setting locates at Settings->WP Super Cache Settings->Advanced->Compress pages so they’re served more quickly to visitors. (Recommended).

You can enable compression from your http server, e.g. nginx, apache httpd.

Nginx proxy for Google URLs in WordPress by @sskaje: