Skip to content

Instantly share code, notes, and snippets.

@ym
Created January 19, 2015 17:21
Show Gist options
  • Save ym/4ef014bff48fac7db05d to your computer and use it in GitHub Desktop.
Save ym/4ef014bff48fac7db05d to your computer and use it in GitHub Desktop.
proxy_set_header Accept-Encoding "";
proxy_set_header X-Forwarded-For $remote_addr;
subs_filter_types text/javascript application/javascript text/css;
subs_filter "https://www.gstatic.com/recaptcha" "https://your-domain/google/recaptcha/static";
subs_filter "https://www.google.com/recaptcha" "https://your-domain/google/recaptcha/endpoint";
subs_filter "https://apis.google.com" "https://your-domain/google/api";
subs_filter "//fonts.gstatic.com" "//your-domain/google/fonts";
subs_filter "google\.com" "your-root-domain\.com";
location = /recaptcha/api.js {
return 301 https://$server_name/google$request_uri;
}
location /google/fonts/ {
proxy_set_header Host fonts.gstatic.com;
proxy_pass https://fonts.gstatic.com/;
}
location = /google/fonts/css {
proxy_set_header Host fonts.googleapis.com;
proxy_pass https://fonts.googleapis.com/css;
include google.conf;
}
location = /google/recaptcha/api.js {
proxy_set_header Host www.google.com;
proxy_pass https://www.google.com/recaptcha/api.js;
include google.conf;
}
location /google/recaptcha/static/ {
proxy_set_header Host www.gstatic.com;
proxy_pass https://www.gstatic.com/recaptcha/;
include google.conf;
}
location /google/recaptcha/endpoint/ {
proxy_set_header Host www.google.com;
proxy_pass https://www.google.com/recaptcha/;
include google.conf;
}
location /recaptcha/ {
proxy_set_header Host www.google.com;
proxy_pass https://www.google.com/recaptcha/;
include google.conf;
}
location /google/api/ {
proxy_set_header Host apis.google.com;
proxy_pass https://apis.google.com/;
include google.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment