Last active
May 18, 2017 20:03
-
-
Save 0xDing/428bc3c1c93ddc4fe8ea62a8413639f8 to your computer and use it in GitHub Desktop.
Google Analytics Proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 http2 ssl; | |
server_name analytics.example.com; | |
location /ga_proxy { | |
proxy_set_header X-real-ip $remote_addr; | |
rewrite ^/ga_proxy/(.*)$ /$1?$args&uip=$remote_addr; | |
proxy_pass http://www.google-analytics.com; | |
break; | |
} | |
location /analytics.js { | |
proxy_set_header X-real-ip $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Referer https://www.google-analytics.com; | |
proxy_set_header Host www.google-analytics.com; | |
proxy_pass https://www.google-analytics.com; | |
proxy_set_header Accept-Encoding ""; subs_filter_types text/css text/xml text/javascript; | |
subs_filter www.google-analytics.com analytics.example.com/ga_proxy; | |
} | |
} |
Author
0xDing
commented
Jan 18, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment