You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Google AI Studio gets SNI‑rewritten → connects directly with Iran IP and gets sanctioned #701
When trying to access Google AI Studio (aistudio.google.com) through mhrv-rs, the domain gets SNI‑rewritten (like other Google subdomains). This causes the connection to bypass the proxy tunnel and go directly from my Iran IP address, resulting in a sanctions block.
Expected behavior:
Google AI Studio should be proxied properly so it bypasses sanctions, just like other external sites. [client -> google_script -> cf-worker-node -> website]
Actual behavior:
Because aistudio.google.com is treated as a Google subdomain, mhrv-rs rewrites its SNI to www.google.com. The connection then exits through my direct Iran IP (not through the Apps Script relay) and gets blocked due to sanctions.
Root cause:
The default SNI‑rewrite logic for *.google.com sends these domains through the direct/rewrite tunnel instead of the proxy tunnel.
This would allow specific Google subdomains to be excluded from SNI rewrite and instead be proxied normally through the Apps Script relay (or exit node), so they can bypass sanctions.
@(author) — accurate diagnosis but the "proxy tunnel" you have in mind doesn't exist for Google domains. Two facts:
1. SNI rewrite doesn't hide your IP, just your SNI. When mhrv-rs SNI-rewrites aistudio.google.com to www.google.com, it still TCP-connects to Google's edge IP from your machine's IP. Google's edge sees your real Iran IP. The SNI rewrite only hides the destination hostname from your ISP's DPI — it doesn't proxy the connection through Google.
2. Apps Script can't relay Google services (self-loop block). If we routed aistudio.google.com through the Apps Script relay (= what your cf-worker-node mental model does), Apps Script's UrlFetchApp.fetch() to aistudio.google.com returns Exception: DNS Hatası — Google blocks Apps Script from reaching its own services. Same root cause as why YouTube videos can't go through the relay.
Solution: exit-node. The path that works is client → Apps Script (Google datacenter IP) → val.town (non-Google, non-Iran IP) → aistudio.google.com. The destination sees val.town's IP, which is neither Iran nor Google — sanction check passes, anti-bot doesn't fire.
When aistudio.google.com is in exit_node.hosts, mhrv-rs bypasses the SNI-rewrite path for that host and sends it through the exit node instead — exactly what you wanted, just via existing config rather than a new flag.
I'll add aistudio.google.com + ai.google.dev to the example config. No code change needed — the routing is already in place. Closing as resolved by exit-node.
[reply via Anthropic Claude | reviewed by @therealaleph]
Hi, thank you for the recent changes. The setup works perfectly in full_node mode with an exit node.
However, when using the Google Script -> CF Worker flow (i.e., running the app in app_script mode), Google hosts cannot be proxied as expected.
The root cause:
In app_script mode, all Google subdomains have their SNI rewritten by default. This becomes problematic when trying to reach Google AI Studio because we are connecting to it with our real IP from Iran which will be blocked. so we can bypass the sanctions by connecting to it through app_script proxy, not directly from the Google Script itself, but when a Cloudflare Worker is used as the endpoint of the chain (via Code.cfw.gs).
To successfully connect to Google AI Studio through the app_script -> CF Worker chain, we need to bypass SNI rewriting for certain Google subdomains, so they can be properly proxied and thus circumvent sanctions.
Proposed fix:
Add an EXCLUDE_SNI_REWRITE_SUBDOMAINS_LIST configuration option to app_script mode. This would allow users to specify addresses like Google AI Studio, ensuring they are proxied through the Google Script -> CF Worker pipeline without SNI modification.
Activity
therealaleph commentedon May 4, 2026
@(author) — accurate diagnosis but the "proxy tunnel" you have in mind doesn't exist for Google domains. Two facts:
1. SNI rewrite doesn't hide your IP, just your SNI. When mhrv-rs SNI-rewrites
aistudio.google.comtowww.google.com, it still TCP-connects to Google's edge IP from your machine's IP. Google's edge sees your real Iran IP. The SNI rewrite only hides the destination hostname from your ISP's DPI — it doesn't proxy the connection through Google.2. Apps Script can't relay Google services (self-loop block). If we routed
aistudio.google.comthrough the Apps Script relay (= what yourcf-worker-nodemental model does), Apps Script'sUrlFetchApp.fetch()toaistudio.google.comreturnsException: DNS Hatası— Google blocks Apps Script from reaching its own services. Same root cause as why YouTube videos can't go through the relay.Solution: exit-node. The path that works is
client → Apps Script (Google datacenter IP) → val.town (non-Google, non-Iran IP) → aistudio.google.com. The destination sees val.town's IP, which is neither Iran nor Google — sanction check passes, anti-bot doesn't fire.Setup steps:
assets/exit_node/README.fa.md. 5 minutes, free tier. Then inconfig.json:When
aistudio.google.comis inexit_node.hosts, mhrv-rs bypasses the SNI-rewrite path for that host and sends it through the exit node instead — exactly what you wanted, just via existing config rather than a new flag.I'll add
aistudio.google.com+ai.google.devto the example config. No code change needed — the routing is already in place. Closing as resolved by exit-node.[reply via Anthropic Claude | reviewed by @therealaleph]
fix: v1.9.9 — Android second disconnect crash + tunnel-node drain cor…
TKZ700 commentedon May 4, 2026
Hi, thank you for the recent changes. The setup works perfectly in full_node mode with an exit node.
However, when using the Google Script -> CF Worker flow (i.e., running the app in app_script mode), Google hosts cannot be proxied as expected.
The root cause:
In app_script mode, all Google subdomains have their SNI rewritten by default. This becomes problematic when trying to reach Google AI Studio because we are connecting to it with our real IP from Iran which will be blocked. so we can bypass the sanctions by connecting to it through app_script proxy, not directly from the Google Script itself, but when a Cloudflare Worker is used as the endpoint of the chain (via Code.cfw.gs).
To successfully connect to Google AI Studio through the app_script -> CF Worker chain, we need to bypass SNI rewriting for certain Google subdomains, so they can be properly proxied and thus circumvent sanctions.
Proposed fix:
Add an EXCLUDE_SNI_REWRITE_SUBDOMAINS_LIST configuration option to app_script mode. This would allow users to specify addresses like Google AI Studio, ensuring they are proxied through the Google Script -> CF Worker pipeline without SNI modification.
Looking forward to your thoughts.