Skip to content

Instantly share code, notes, and snippets.

@lsgrep
Last active August 29, 2015 14:18
Show Gist options
  • Save lsgrep/ec3869ab6a747691c015 to your computer and use it in GitHub Desktop.
Save lsgrep/ec3869ab6a747691c015 to your computer and use it in GitHub Desktop.
location / {
proxy_redirect off;
proxy_pass http://www.google.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding ""; #2
proxy_set_header User-Agent "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 (this is for 3.2 beta 3)"; #3
proxy_set_header Accept-Language "en-US"; #4
proxy_set_header Cookie "PREF=ID=xxxxxx:U=yyyyy:FF=0:LD=zh-CN:NW=1:CR=2:TM=zzzz:LM=mmmmm:GM=1:SG=1:S=-nnnnn"; #5
sub_filter www.google.com "yourwebsite";
sub_filter_once off;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment