nginx-config-proxy-uptimerobot
This file contains 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 80; | |
server_name status.nddcoder.com; | |
location / { | |
#proxy requests đến Uptimerobot | |
proxy_pass https://stats.uptimerobot.com/ojM8Acwzq/; | |
#Gửi server_name khi handshake SSL, nếu off thì sẽ bị lỗi SSL | |
proxy_ssl_server_name on; | |
#Set header này thì response trả về từ Uptimerobot không bị nén, từ đó mình có thể replace ở bước dưới | |
proxy_set_header Accept-Encoding ""; | |
#Uptimerobot dùng header này với giá trị 'upgrade-insecure-requests' để trình duyệt luôn load các css/js với HTTPS. Ẩn header này để có thể truy cập vào status.nddcoder.com mà không cần HTTPS | |
proxy_hide_header Content-Security-Policy; | |
#Replace 1 số link trong response để website load tài nguyên, các nút trên giao diện hoạt động chính xác | |
sub_filter https://stats.uptimerobot.com/ojM8Acwzq /; | |
sub_filter https://stats.uptimerobot.com/ /; | |
#Xóa GTM để Uptimerobot không tracking được mình 😀 | |
sub_filter '<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1748433-46"></script>' ''; | |
#Replace all | |
sub_filter_once off; | |
} | |
#Proxy assets requests | |
location /assets { | |
proxy_pass https://stats.uptimerobot.com/assets; | |
proxy_ssl_server_name on; | |
} | |
#Proxy api requests | |
location /api { | |
proxy_pass https://stats.uptimerobot.com/api; | |
proxy_ssl_server_name on; | |
} | |
} | |
# vim: syntax=nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment