server { listen 127.0.0.1:8000; # Here we will listen for incoming from I2P connections #server_name .b32.i2p .i2p; # We receive any domain, so that option is commented access_log /dev/null; error_log /dev/null warn; add_header X-Frame-Options 'SAMEORIGIN'; add_header X-Xss-Protection '1; mode=block'; add_header X-Content-Type-Options 'nosniff'; root /path/to/webogram-i2p/dist; index index.html; charset utf8; sub_filter_once off; sub_filter_last_modified on; sub_filter_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/javascript application/json application/xml+rss; location / { try_files $uri $uri/ /index.html; sub_filter "https://web.telegram.org/" "http://$server_name/"; } proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; location ~* ^/web/ { rewrite ^/web/(.*)/(.*) /$2 break; proxy_pass https://$1.web.telegram.org; } # That blocks required for websync location ~* ^/telegram-me/ { rewrite ^/telegram-me/(.*) /$1 break; proxy_pass https://telegram.me; } location ~* ^/t-me/ { rewrite ^/t-me/(.*) /$1 break; proxy_pass https://t.me; } }