Skip to content

Weird youtube behavior #61

Closed
Closed

Description

@Feiabyte

Hi I'm writing this to report an issue with YouTube that is present in the original project (MasterHttpRelayVPN) as well. The YouTube homepage loads and at first sight you don't see any problems but when you open any video and I've tested many of them, the comment section is restricted and you can't see the comments. furthermore, the second problem is that when you want to load a YouTube channel and see their videos, the videos either don't show up on their channel or there are only a few of them shown which are some old videos. note that the videos suggested on the home page are fine. the last problem is when you click on some of the suggested videos the page loads, but it says that the video is restricted, i noticed that the videos that are not shown in the YouTube channel page and are suggested to you behave like this. lastly, I've checked the same videos and channels without using MasterHttpRelayVPN-RUST and they show up and work fine.
PS: seems like someone else noticed this and made a pull request which you declined for some valid reasons. it would be appreciated if you can look into it and solve this problem
thanks

Activity

  1. therealaleph commented on Apr 23, 2026

    @therealaleph
    Owner

    Thanks for the detailed report — this is a known behaviour of the Apps-Script path and it maps to two YouTube quirks:

    1. Comments restricted / not loading: YouTube's comment endpoint (www.youtube.com/youtubei/v1/next) is a POST with a big JSON body that includes X-Goog-Visitor-Id, X-YouTube-Client-Version, and a context.clickTracking blob. Apps Script's UrlFetchApp strips/rewrites several of those headers — in particular User-Agent is hard-pinned to Google-Apps-Script and some of the X-YouTube-* headers get dropped. The YouTube backend sees a "client" it doesn't recognise and degrades into restricted mode. Same mechanism as comments-hidden-on-logged-out-sessions.

    2. Channel videos empty / fewer than real / "video restricted" on suggested videos: the age-gate and location-gate on YouTube keys off the visitor-id cookie + the client IP that reaches their edge. The client IP that YouTube sees for googlevideo.com fetches through Apps Script is a Google-internal IP — in some cases this trips YouTube's own abuse logic (the fetcher IP range looks suspicious), in others it's mis-located so region-restricted videos get hidden. Nothing we can do client-side to change the visitor-id because Apps Script strips our cookies too.

    Why the Python version seemed fine: we actually just matched Python's fetch logic in v1.1.4 (expanded SNI-rewrite to gvt1/gvt2/ytimg/etc., plus a range-parallel fetcher mirroring relay_parallel). That made video playback stream properly. The comments + channel-listing issues exist in the Python version too — users just tend to notice them less when the stream works. I don't think there's a closed PR for that specific issue on this repo, but if you link the one you meant I can reconsider.

    Workaround: v1.2.0 ships a google_only mode where all youtube.com / googlevideo.com traffic goes direct via the SNI-rewrite tunnel (no Apps Script). If your ISP lets you reach www.youtube.com:443 directly when the SNI is rewritten to www.google.com, you get real YouTube behaviour — comments, channel listings, everything, because the request carries your real IP and cookies. Try v1.2.0 and report back whether comments load in google_only mode; if they do, we can consider making YouTube special-case even in apps_script mode.

    Adding this to the known-limitations section of the README.

  2. hypomanik commented on Apr 23, 2026

    @hypomanik

    The google-only mode inv1.2.0 also features youtube restricted mode . Please add youtube speacial-case

  3. Feiabyte commented on Apr 23, 2026

    @Feiabyte
    Author

    Thanks for the reply. upon further inspection as you instructed, weirdly enough, even with the google-only mode i experienced the exact same problem with both comments and the videos not showing up on the channels. it seems like the problem runs much deeper.
    on my previous statement i mention a PR I was reffering to this:
    #55
    which you closed it for valid reasons but maybe you can use this and implement a fix for the problem.
    while youtube loads and some videos show up randomly, it's useless since you can't watch the videos you're looking for.
    I appreciate your attention and I'm hopeful that you'll find a fix.

  4. therealaleph commented on Apr 23, 2026

    @therealaleph
    Owner

    The google-only mode in v1.2.0 also features youtube restricted mode

    That one's harder to fix from our side than the Apps-Script case, because in google_only mode YouTube sees your real IP and your real cookies — there's no User-Agent rewriting going on, and no visitor-id stripping. So whatever restricted state you're seeing is what a stock browser on your network would see without the tool at all. Two likely causes:

    1. Account-level Restricted Mode enabled. Open YouTube logged-in, scroll to the bottom-left of the homepage (desktop) or Account → Settings → General (mobile), and verify the "Restricted Mode" toggle is off. This setting is sticky to the Google account and travels across networks.

    2. Network/region restriction imposed by YouTube itself. google_only makes the TCP connect hit google_ip:443 but the SNI is rewritten to www.google.com — after TLS, YouTube sees the real Host: www.youtube.com plus your real source IP. If that source IP is in a region YouTube geo-restricts (or on a blocklist), you get the restricted view. Test: connect to the same YouTube video on the same network, from a Windows/Linux laptop without mhrv-rs running. If it's still restricted there, it's not our layer.

    A real "YouTube special-case" in apps_script mode is not something I can currently do — the headers Apps Script strips (User-Agent, X-Goog-Visitor-Id, cookies) are stripped server-side by Google's UrlFetchApp runtime. I have no control over them.

    What I can do that might help: if you can reliably reproduce restricted mode in google_only mode on a specific video, please send me (a) the video URL, (b) a logcat | grep mhrv snippet from the minute you opened the video, and (c) whether the same video plays normally in a stock browser on the same network. That'll tell us whether it's a YouTube-side restriction or something the tool is measurably adding.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  5. Feiabyte commented on Apr 23, 2026

    @Feiabyte
    Author

    I see. this is trickier than we thought. since I live in Iran, I can't test the video without using some kind of VPN but I can give you videos and channels with the problems I mentioned. also, I'm on PC so If you can tell how I can provide something like logcat on PC I'll provide that as well next.
    PS: Comments are broken on almost every video I open so I'll send you 2 examples of the videos that don't even play and the channels that show up with fewer than usual videos.
    https://www.youtube.com/watch?v=v1PZra0Pdfo
    https://www.youtube.com/watch?v=GWN3i4J8Fo0
    https://www.youtube.com/@bluesquadronlive
    https://www.youtube.com/@timthetatman
    also is there a way to connect to a vps using x-ui backend to solve the problems with all the services that have an issue with ip and stuff?

  6. BOplaid commented on Apr 23, 2026

    @BOplaid

    This is almost certainly something the censor in Iran is doing, like that time they forced SafeSearch onto Google Search. The solution is simple: Don't route YT through the SNI-rewrite tunnel; rather, through the MITM and Apps Script tunnel.

  7. BOplaid commented on Apr 23, 2026

    @BOplaid

    also is there a way to connect to a vps using x-ui backend to solve the problems with all the services that have an issue with ip and stuff?

    Mix xray with the upstream proxy option

  8. BOplaid commented on Apr 23, 2026

    @BOplaid

    [reply via Anthropic Claude | reviewed by @therealaleph]

    ???

  9. Feiabyte commented on Apr 23, 2026

    @Feiabyte
    Author

    also is there a way to connect to a vps using x-ui backend to solve the problems with all the services that have an issue with ip and stuff?

    Mix xray with the upstream proxy option

    can you help me set this up? i have vps with x-ui installed on it there isn't enough doc to know what to do.

  10. therealaleph commented on Apr 23, 2026

    @therealaleph
    Owner

    Thanks for the URLs and the offer to help — those are easy to test.

    To capture the equivalent of logcat on PC: the Rust side logs to stderr + to the log pane in the UI. Easiest capture:

    1. Open config.json (location differs by OS — on Windows %APPDATA%\mhrv-rs\config.json) and set "log_level": "debug".
    2. Run mhrv-rs.exe (CLI) from a CMD prompt so you see stderr in the console: mhrv-rs.exe > mhrv.log 2>&1.
    3. Load one of the failing videos from the browser pointed at the proxy, let it do its thing for ~30 seconds.
    4. Ctrl-C to stop, paste mhrv.log into a gist.

    That'll tell me whether our relay path is timing out, rewriting headers wrong, or whether YouTube is flat-rejecting the response based on what it sees.

    About the "x-ui backend" idea: that's exactly what upstream_socks5 in Advanced settings does — point it at the SOCKS5 endpoint of your x-ui (or any VPS) outbound, and every Apps Script fetch (+ every plain-TCP passthrough) egresses via that VPS. YouTube then sees your VPS IP instead of Google's Apps-Script-fetcher IP. This won't fix the User-Agent: Google-Apps-Script and visitor-id stripping in apps_script mode, but combined with google_only mode (v1.2.0) + upstream_socks5 pointing at a VPS outside Iran, you'd effectively be running a Netherlands-sourced connection to YouTube that tunnels through mhrv-rs's SNI-rewrite without any Apps-Script-layer header mangling. That's the closest current workaround to "YouTube as if you were on the VPS."

    Worth trying:

    {
      "mode": "google_only",
      "upstream_socks5": "your-vps:1080",
      ...
    }

    Let me know what the log shows and whether the VPS path helps.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  11. Feiabyte commented on Apr 23, 2026

    @Feiabyte
    Author

    The google-only mode in v1.2.0 also features youtube restricted mode

    That one's harder to fix from our side than the Apps-Script case, because in google_only mode YouTube sees your real IP and your real cookies — there's no User-Agent rewriting going on, and no visitor-id stripping. So whatever restricted state you're seeing is what a stock browser on your network would see without the tool at all. Two likely causes:

    1. Account-level Restricted Mode enabled. Open YouTube logged-in, scroll to the bottom-left of the homepage (desktop) or Account → Settings → General (mobile), and verify the "Restricted Mode" toggle is off. This setting is sticky to the Google account and travels across networks.
    2. Network/region restriction imposed by YouTube itself. google_only makes the TCP connect hit google_ip:443 but the SNI is rewritten to www.google.com — after TLS, YouTube sees the real Host: www.youtube.com plus your real source IP. If that source IP is in a region YouTube geo-restricts (or on a blocklist), you get the restricted view. Test: connect to the same YouTube video on the same network, from a Windows/Linux laptop without mhrv-rs running. If it's still restricted there, it's not our layer.

    A real "YouTube special-case" in apps_script mode is not something I can currently do — the headers Apps Script strips (User-Agent, X-Goog-Visitor-Id, cookies) are stripped server-side by Google's UrlFetchApp runtime. I have no control over them.

    What I can do that might help: if you can reliably reproduce restricted mode in google_only mode on a specific video, please send me (a) the video URL, (b) a logcat | grep mhrv snippet from the minute you opened the video, and (c) whether the same video plays normally in a stock browser on the same network. That'll tell us whether it's a YouTube-side restriction or something the tool is measurably adding.

    [reply via Anthropic Claude | reviewed by @therealaleph]

    ok i did as you instructed, I changed the log to debug, ran the mhrv-rs.exe in CMD and copied the logs for 3 connections from the moment I started loading them. first its the video that didn't even load, the second is the channel that it's videos doesn't show up and the third one is a video that loads and plays but the comments doesn't show. let me know if you need anything else about this.
    about the x-ui part, as I said I have a vps in turkey that has https://github.com/MHSanaei/3x-ui panel installed on it but can you help me go from here? Im completely fimiliar with making configues with x-ui but I don't know how to connect it to the upstream_socks5. do I make a normal vless/tcp configue and use the vps ip and the configue port? do I connect to the configue via v2ray and use v2ray local socks5 address and port? if you can help me set this up I'll test it and give the results and you can make a guide for it in the readme. I can even test the cloudflare problem.
    note that the ip of the vps is filtered where I live but i can access it via vpn
    thanks.

    here's the gist:
    https://gist.github.com/Feiabyte/979aad82a313b9be795ec750e1efa66f

  12. therealaleph commented on Apr 23, 2026

    @therealaleph
    Owner

    Thanks for the gist — it's exactly what I needed. Analysis:

    What the logs show:

    • All three test cases route www.youtube.com via SNI-rewrite tunnel to 216.239.38.120 (your configured google_ip). TLS handshake passes, the tunnel works — the browser is successfully reaching YouTube through us.
    • For the channel page case (@bluesquadronlive): the browser loads the HTML shell via sni-rewrite, but I don't see any youtubei/v1/browse POSTs in the log. That means the browser either got 200 OK with an empty/partial JSON from YouTube, or YouTube's edge quietly redirected and the browser gave up.
    • For the playing video: I see relay POST https://rr1---sn-5ualdnsl.googlevideo.com/videoplayback?... — video chunks flowing through Apps Script relay fine. Stream works.

    Why comments / channel pages break specifically:

    In sni-rewrite mode, the TLS handshake goes to google_ip:443 (216.239.38.120). After TLS, YouTube's backend sees:

    • Host: www.youtube.com ✓
    • Your real session cookies ✓
    • Source IP = 216.239.38.120 (or whatever IP Google's edge forwards from)

    That last bit is the problem. YouTube's abuse heuristics treat traffic with a source IP inside Google's own CDN/GFE range as suspicious — "why is a Google edge IP making authenticated requests?" — and silently degrade specific endpoints: comments (/youtubei/v1/next), channel feeds (/youtubei/v1/browse), recommendations. The video player endpoints (/videoplayback, /generate_204) don't apply the same gate because those are content delivery, not UGC APIs.

    This is why comments break on both apps_script and google_only modes — the source IP reaching YouTube is always Google-edge IP in both.

    The only fix: egress from a non-Google IP. That's what upstream_socks5 does. Everything mhrv-rs sends outbound (Apps Script fetches + plain-tcp + the sni-rewrite tunnel) goes via the SOCKS5 first.


    3x-ui setup for upstream_socks5:

    Your 3x-ui VPS needs to expose a SOCKS5 inbound:

    1. In 3x-ui web panel → Inbounds → Add Inbound → Protocol: socks
    2. Port: pick something ≥ 10000 (say 38787)
    3. Check "Settings" → add a user with username + password
    4. Remark: "mhrv-rs-upstream"
    5. Save + make sure it's enabled

    Then in mhrv-rs config.json on your client:

    {
      "mode": "apps_script",
      "upstream_socks5": "user:pass@VPS_PUBLIC_IP:38787",
      ...rest of config...
    }

    Restart mhrv-rs. You should see tcp via upstream-socks5 <host:port> -> ... lines in the log for every outbound connection.

    The VPS-IP-blocked problem:

    You mentioned your VPS IP is filtered at your ISP and only reachable via VPN. That's a separate tunneling problem before we even get to mhrv-rs. A few realistic options:

    1. Run xray-client locally on your machine with a VLESS/Reality outbound to your 3x-ui VPS. Reality disguises the traffic as normal HTTPS to a whitelisted SNI (e.g. www.cloudflare.com). Local xray exposes a SOCKS5 on 127.0.0.1:1080. Then set upstream_socks5 = 127.0.0.1:1080 in mhrv-rs. The chain is:

      browser → mhrv-rs → 127.0.0.1:1080 (xray client) → VLESS/Reality → VPS → YouTube

      mhrv-rs + Apps Script still bypasses DPI to reach google_ip, while xray+Reality handles the VPS reachability. Best-of-both. 3x-ui has a Reality client-config export button that produces a vless://... link you paste into xray.

    2. Set up a secondary VPS with a non-filtered IP. Cheap ($3-5/mo at BuyVM, Hetzner, Contabo) — the traffic from mhrv-rs to that second VPS is pure SOCKS5 handshake + TCP data, nothing DPI-interesting because you're in Turkey already from YouTube's view.

    3. Cloudflare WARP as a stopgap. Install cloudflared locally, it exposes a SOCKS5 proxy, point upstream_socks5 at it. Free, source IP is Cloudflare's (not Google's), YouTube comments should work. Downside: limited bandwidth for heavy video.

    If you pick option 1 or 3 and it works, I'll add a section to the README walking through the 3x-ui Reality + mhrv-rs upstream_socks5 setup. Please test and report — the Cloudflare angle you mentioned is also worth trying.


    A concrete test to verify the theory: temporarily point upstream_socks5 at any non-Google SOCKS5 (even a free public one for a one-shot test) and reload one of the broken channel pages. If comments/videos appear, the source-IP theory is confirmed. If they're still broken, something else is going on.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  13. Feiabyte commented on Apr 23, 2026

    @Feiabyte
    Author

    Thanks for the gist — it's exactly what I needed. Analysis:

    What the logs show:

    • All three test cases route www.youtube.com via SNI-rewrite tunnel to 216.239.38.120 (your configured google_ip). TLS handshake passes, the tunnel works — the browser is successfully reaching YouTube through us.
    • For the channel page case (@bluesquadronlive): the browser loads the HTML shell via sni-rewrite, but I don't see any youtubei/v1/browse POSTs in the log. That means the browser either got 200 OK with an empty/partial JSON from YouTube, or YouTube's edge quietly redirected and the browser gave up.
    • For the playing video: I see relay POST https://rr1---sn-5ualdnsl.googlevideo.com/videoplayback?... — video chunks flowing through Apps Script relay fine. Stream works.

    Why comments / channel pages break specifically:

    In sni-rewrite mode, the TLS handshake goes to google_ip:443 (216.239.38.120). After TLS, YouTube's backend sees:

    • Host: www.youtube.com ✓
    • Your real session cookies ✓
    • Source IP = 216.239.38.120 (or whatever IP Google's edge forwards from)

    That last bit is the problem. YouTube's abuse heuristics treat traffic with a source IP inside Google's own CDN/GFE range as suspicious — "why is a Google edge IP making authenticated requests?" — and silently degrade specific endpoints: comments (/youtubei/v1/next), channel feeds (/youtubei/v1/browse), recommendations. The video player endpoints (/videoplayback, /generate_204) don't apply the same gate because those are content delivery, not UGC APIs.

    This is why comments break on both apps_script and google_only modes — the source IP reaching YouTube is always Google-edge IP in both.

    The only fix: egress from a non-Google IP. That's what upstream_socks5 does. Everything mhrv-rs sends outbound (Apps Script fetches + plain-tcp + the sni-rewrite tunnel) goes via the SOCKS5 first.

    3x-ui setup for upstream_socks5:

    Your 3x-ui VPS needs to expose a SOCKS5 inbound:

    1. In 3x-ui web panel → Inbounds → Add Inbound → Protocol: socks
    2. Port: pick something ≥ 10000 (say 38787)
    3. Check "Settings" → add a user with username + password
    4. Remark: "mhrv-rs-upstream"
    5. Save + make sure it's enabled

    Then in mhrv-rs config.json on your client:

    {
    "mode": "apps_script",
    "upstream_socks5": "user:pass@VPS_PUBLIC_IP:38787",
    ...rest of config...
    }
    Restart mhrv-rs. You should see tcp via upstream-socks5 <host:port> -> ... lines in the log for every outbound connection.

    The VPS-IP-blocked problem:

    You mentioned your VPS IP is filtered at your ISP and only reachable via VPN. That's a separate tunneling problem before we even get to mhrv-rs. A few realistic options:

    1. Run xray-client locally on your machine with a VLESS/Reality outbound to your 3x-ui VPS. Reality disguises the traffic as normal HTTPS to a whitelisted SNI (e.g. www.cloudflare.com). Local xray exposes a SOCKS5 on 127.0.0.1:1080. Then set upstream_socks5 = 127.0.0.1:1080 in mhrv-rs. The chain is:
      browser → mhrv-rs → 127.0.0.1:1080 (xray client) → VLESS/Reality → VPS → YouTube
      mhrv-rs + Apps Script still bypasses DPI to reach google_ip, while xray+Reality handles the VPS reachability. Best-of-both. 3x-ui has a Reality client-config export button that produces a vless://... link you paste into xray.
    2. Set up a secondary VPS with a non-filtered IP. Cheap ($3-5/mo at BuyVM, Hetzner, Contabo) — the traffic from mhrv-rs to that second VPS is pure SOCKS5 handshake + TCP data, nothing DPI-interesting because you're in Turkey already from YouTube's view.
    3. Cloudflare WARP as a stopgap. Install cloudflared locally, it exposes a SOCKS5 proxy, point upstream_socks5 at it. Free, source IP is Cloudflare's (not Google's), YouTube comments should work. Downside: limited bandwidth for heavy video.

    If you pick option 1 or 3 and it works, I'll add a section to the README walking through the 3x-ui Reality + mhrv-rs upstream_socks5 setup. Please test and report — the Cloudflare angle you mentioned is also worth trying.

    A concrete test to verify the theory: temporarily point upstream_socks5 at any non-Google SOCKS5 (even a free public one for a one-shot test) and reload one of the broken channel pages. If comments/videos appear, the source-IP theory is confirmed. If they're still broken, something else is going on.

    [reply via Anthropic Claude | reviewed by @therealaleph]

    I see its good that we found what the problem was and I'm happy that i helped.
    about the fix, I must've said it wrong, I'm not in turkey I live in Iran I have a VPS in turkey. so cloudflare and Reality protocol are completely disabled. they wont work right? as for option 2, the connection to outside of Iran is almost non-existant so I won't be able to find any VPS that would work. what do you suggest we do? I can help with finding a way. I don't think option 1 would work right? is there anything we can do?

  14. therealaleph commented on Apr 23, 2026

    @therealaleph
    Owner

    Thanks for the clarification — you're in Iran, your VPS is in Turkey, and the standard options (direct to VPS, Cloudflare, Reality) are all blocked from your ISP. That's a harder constraint and totally valid.

    There's actually a fix that matches your constraints almost perfectly: a feature called "full tunnel mode" that just landed partially today. The scaffolding is in main (PR #93 merged a few minutes ago); the Rust-side dispatch (PR #94) is still in review. The idea is exactly what you need:

    (your client in Iran) 
      → mhrv-rs
        → script.google.com (reachable from Iran — unblocked)
          → Apps Script (UrlFetchApp)
            → your Turkey VPS (reachable from Google's infrastructure, not your ISP)
              → YouTube
    

    Apps Script runs on Google's datacenter IPs, which can reach your Turkey VPS (because Google's egress isn't what your ISP is blocking). Your ISP blocking your VPS's IP only matters for direct client-to-VPS connections — with Apps Script as the tunnel transport, you don't need to reach your VPS directly. YouTube then sees your VPS's Turkey IP, not Google's, so comments / channels / recommendations all work.

    To prepare for this while #94 is still in review:

    On your Turkey VPS, deploy the tunnel-node service that landed in PR #93. It's at tunnel-node/ in the repo now, and there's a Dockerfile:

    # on your Turkey VPS:
    git clone https://github.com/therealaleph/MasterHttpRelayVPN-RUST.git
    cd MasterHttpRelayVPN-RUST/tunnel-node
    # read tunnel-node/README.md for full config — roughly:
    docker build -t mhrv-tunnel-node .
    docker run -d --name mhrv-tun -p 8080:8080 mhrv-tunnel-node

    (check the README.md inside tunnel-node/ for the actual flags / env vars — I haven't exhaustively tested the script yet.)

    Then deploy assets/apps_script/CodeFull.gs as a second Apps Script alongside your existing one, pointed at your tunnel-node URL.

    Once PR #94 lands (should be this week), you'll flip mode: full + the tunnel-node URL + your existing script deployment ID in config.json, and the chain above activates automatically.

    Would you be willing to be the first end-to-end tester for this once #94 merges? Your exact scenario (Iran ISP + blocked VPS + need YouTube comments) is the primary motivating use case. I'll ping you when #94's ready.

    In the meantime, for everyday use, the existing sni-rewrite behaviour will keep video streaming working. Comments will just stay broken until full-tunnel ships.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  15. Feiabyte commented on Apr 23, 2026

    @Feiabyte
    Author

    Thanks for the clarification — you're in Iran, your VPS is in Turkey, and the standard options (direct to VPS, Cloudflare, Reality) are all blocked from your ISP. That's a harder constraint and totally valid.

    There's actually a fix that matches your constraints almost perfectly: a feature called "full tunnel mode" that just landed partially today. The scaffolding is in main (PR #93 merged a few minutes ago); the Rust-side dispatch (PR #94) is still in review. The idea is exactly what you need:

    (your client in Iran) 
      → mhrv-rs
        → script.google.com (reachable from Iran — unblocked)
          → Apps Script (UrlFetchApp)
            → your Turkey VPS (reachable from Google's infrastructure, not your ISP)
              → YouTube
    

    Apps Script runs on Google's datacenter IPs, which can reach your Turkey VPS (because Google's egress isn't what your ISP is blocking). Your ISP blocking your VPS's IP only matters for direct client-to-VPS connections — with Apps Script as the tunnel transport, you don't need to reach your VPS directly. YouTube then sees your VPS's Turkey IP, not Google's, so comments / channels / recommendations all work.

    To prepare for this while #94 is still in review:

    On your Turkey VPS, deploy the tunnel-node service that landed in PR #93. It's at tunnel-node/ in the repo now, and there's a Dockerfile:

    on your Turkey VPS:

    git clone https://github.com/therealaleph/MasterHttpRelayVPN-RUST.git
    cd MasterHttpRelayVPN-RUST/tunnel-node

    read tunnel-node/README.md for full config — roughly:

    docker build -t mhrv-tunnel-node .
    docker run -d --name mhrv-tun -p 8080:8080 mhrv-tunnel-node
    (check the README.md inside tunnel-node/ for the actual flags / env vars — I haven't exhaustively tested the script yet.)

    Then deploy assets/apps_script/CodeFull.gs as a second Apps Script alongside your existing one, pointed at your tunnel-node URL.

    Once PR #94 lands (should be this week), you'll flip mode: full + the tunnel-node URL + your existing script deployment ID in config.json, and the chain above activates automatically.

    Would you be willing to be the first end-to-end tester for this once #94 merges? Your exact scenario (Iran ISP + blocked VPS + need YouTube comments) is the primary motivating use case. I'll ping you when #94's ready.

    In the meantime, for everyday use, the existing sni-rewrite behaviour will keep video streaming working. Comments will just stay broken until full-tunnel ships.

    [reply via Anthropic Claude | reviewed by @therealaleph]

    Thanks for your help. I was actually following that PR a few hours ago. it got my interest since it tries to solve the same problem me and lots of people are facing.
    About being the first end-to-end tester, I'd be happy to help just let me know when it's ready I'll help however I can as soon as I can. I'll get the vps ready as you told me so we won't waste any time. I hope it gets ready soon.

  16. 56 remaining items

  17. Feiabyte commented on Apr 24, 2026

    @Feiabyte
    Author

    @Feiabyte i think you have some deployment ids in your config that are not active. leave one only now.

    That's Apps Script returning its HTML sandbox page instead of JSON — meaning the deployment ID is hitting the Apps Script editor/sandbox URL rather than the execution endpoint.
    
      This usually means:                                                                                                                                                                     
      - The deployment ID is stale or invalid — it was deleted/redeployed and the old ID no longer points to an active web app
      - Or the deployment was created as "Test deployment" instead of "New deployment" (test deployments return the sandbox HTML)  
    

    I see let me check that and get back to you

  18. Feiabyte commented on Apr 24, 2026

    @Feiabyte
    Author

    weirdly enough I couldn't get the error to pop up again and it's gone on its own

  19. Feiabyte commented on Apr 24, 2026

    @Feiabyte
    Author

    @vahidlazio also is there a reason that the android verson works better?

  20. vahidlazio commented on Apr 24, 2026

    @vahidlazio
    Contributor

    @Feiabyte "might" be some requests not proxying. android tunnels all requests.

  21. Feiabyte commented on Apr 24, 2026

    @Feiabyte
    Author

    @Feiabyte "might" be some requests not proxying. android tunnels all requests.

    yeah maybe but even youtube loads better and faster
    #153
    this could be huge if it works

  22. therealaleph commented on Apr 24, 2026

    @therealaleph
    Owner

    @Feiabyte good timing — PR #153 just merged and shipped as v1.4.0 (tagged ~10 minutes ago). Once the release workflow finishes building, the new APK will have it. Watch the Releases page.

    What you'll see if the optimization is working: in the Live Logs, every ~100 connections an info-level summary lands like:

    connect_data preread: 73 win / 12 loss / 14 skip(port) / 1 skip(unsup), mean win time 2830µs (ceiling 50000µs)
    
    • win = connection that successfully bundled first bytes with CONNECT (saved ~500-2000ms)
    • loss = pre-read window (50ms) elapsed without any client bytes — fell through to legacy two-RTT path
    • skip(port) = port 21/22/25/80/110/143/587 (server-speaks-first protocols, optimization deliberately skipped)
    • skip(unsup) = your deployment is on an old version of CodeFull.gs / tunnel-node and doesn't support the new op (sticky after first detection)

    For the optimization to actually win, both client and server sides need to be updated. v1.4.0 ships the client. If you're running your own tunnel-node + CodeFull.gs, the server-side changes are in PR #153's tunnel-node/src/main.rs and assets/apps_script/CodeFull.gs — pull those, redeploy tunnel-node, and replace your Apps Script CodeFull.gs with the new content.

    @vahidlazio's "android tunnels all requests" framing is also part of why Android felt better — the TUN bridge captures every IP packet whether the app honors a proxy or not, so you avoid the "this app didn't honor the proxy setting" failure mode that desktop has.

    Together: post-v1.4.0 + redeployed server side + Android TUN = should be a noticeable improvement on YouTube vs what you experienced before. If it still feels off, log snippet showing the connect_data preread: summary would be useful diagnostic data.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  23. Feiabyte commented on Apr 24, 2026

    @Feiabyte
    Author

    @Feiabyte good timing — PR #153 just merged and shipped as v1.4.0 (tagged ~10 minutes ago). Once the release workflow finishes building, the new APK will have it. Watch the Releases page.

    What you'll see if the optimization is working: in the Live Logs, every ~100 connections an info-level summary lands like:

    connect_data preread: 73 win / 12 loss / 14 skip(port) / 1 skip(unsup), mean win time 2830µs (ceiling 50000µs)
    
    • win = connection that successfully bundled first bytes with CONNECT (saved ~500-2000ms)
    • loss = pre-read window (50ms) elapsed without any client bytes — fell through to legacy two-RTT path
    • skip(port) = port 21/22/25/80/110/143/587 (server-speaks-first protocols, optimization deliberately skipped)
    • skip(unsup) = your deployment is on an old version of CodeFull.gs / tunnel-node and doesn't support the new op (sticky after first detection)

    For the optimization to actually win, both client and server sides need to be updated. v1.4.0 ships the client. If you're running your own tunnel-node + CodeFull.gs, the server-side changes are in PR #153's tunnel-node/src/main.rs and assets/apps_script/CodeFull.gs — pull those, redeploy tunnel-node, and replace your Apps Script CodeFull.gs with the new content.

    @vahidlazio's "android tunnels all requests" framing is also part of why Android felt better — the TUN bridge captures every IP packet whether the app honors a proxy or not, so you avoid the "this app didn't honor the proxy setting" failure mode that desktop has.

    Together: post-v1.4.0 + redeployed server side + Android TUN = should be a noticeable improvement on YouTube vs what you experienced before. If it still feels off, log snippet showing the connect_data preread: summary would be useful diagnostic data.

    [reply via Anthropic Claude | reviewed by @therealaleph]

    Thanks for the heads up. I'm updating the tunnel node right now and I'll let you know if I notice anything wrong or any improvements

  24. Feiabyte commented on Apr 24, 2026

    @Feiabyte
    Author

    @therealaleph I installed the new version from the scratch and did as instructed. everything is noticably faster but the weird thing is I don't get the connect_data preread: 73 win / 12 loss / 14 skip(port) / 1 skip(unsup), mean win time 2830µs (ceiling 50000µs) log not on windows nor android

  25. therealaleph commented on Apr 25, 2026

    @therealaleph
    Owner

    @Feiabyte the absent connect_data preread: log line either means (a) the optimization is silently disabled, or (b) you haven't crossed the 100-event reporting threshold, or (c) your log_level is below info.

    Quick checks:

    1. log_level. The summary emits at info level. Open config.json (or the UI's Advanced section) — if log_level is set to warn / error, the line gets filtered out before display. Default is info; only worth checking if you bumped it.

    2. Mode. connect_data preread: only emits in Full Tunnel mode (mode: "full"). It's a tunnel-mux feature; apps_script mode doesn't run TunnelMux at all. If you're using apps_script (the default), you'll never see it. The "noticeably faster" you observed in apps_script is from PR #151's range-stitching cap and just baseline cumulative improvements, not connect_data.

    3. Reporting threshold. The summary fires every 100 connect/connect_data events. New connections, not requests — so loading 50 different sites = roughly 50 events. If you're using sustained connections (one big YouTube stream = ~5 connections), you might genuinely not have hit 100 yet.

    4. Server-side support. Even if all of the above check out, connect_data only wins when both the client (v1.4.0+) AND the deployed CodeFull.gs + tunnel-node understand the new op. If you're hitting an older deployment, the very first connect_data attempt gets UNSUPPORTED_OP, the sticky AtomicBool flips, and every subsequent session falls back to the legacy path. You'd see this as skip(unsup): N in the summary IF the summary was printed — but it only prints once per 100 events. To redeploy:

    • On your VPS: pull this repo's latest tunnel-node/, rebuild + restart it
    • In Apps Script editor: copy the new assets/apps_script/CodeFull.gs over your existing one, then Deploy → Manage deployments → Edit (pencil) → Version: New version → Deploy

    Quick way to force-emit the summary for visibility: load 100+ small pages in a row. Or temporarily set log_level: "debug" in config — that prints individual connect_data decisions per session, not just the every-100 summary. Lots of noise, but you'll see whether the optimization is firing at all.

    If after the above the line still doesn't appear, please share:

    • A 30-second mhrv-rs.log snippet in Full mode while loading google.com
    • Your config.json (auth_key redacted)
    • Whether your tunnel-node + CodeFull.gs are on the v1.4.0+ versions

    [reply via Anthropic Claude | reviewed by @therealaleph]

  26. MirHosseinAmiriNotash commented on Apr 25, 2026

    @MirHosseinAmiriNotash

    الان برای این مشکل یوتوب که ویدیو ها رو پلی نمیکنه و فقط تامنیل ها و پریویو ویدیو ها رو لود میکنه چیکار میشه کرد ؟
    :توی کنسولم مرورگرم این خطا ها رو دارم
    accounts.youtube.com/RotateCookies:1 Failed to load resource: the server responded with a status of 429 ()

    Access to fetch at 'https://rr5---sn-a5mekndl.googlevideo.com/videoplayback?expire=1777124913&ei=0XHsaYSeJtaVhcIPo4uQ-AE&ip=84.47.253.159&id=o-AL4hbjGW0I0Eb5ZDr6Hz2QP4UTrIa9yk5eoc1kiuAROJ&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=178&met=1777103313%2C&mh=no&mm=31%2C29&mn=sn-vgqsrndl%2Csn-a5mekndl&ms=au%2Crdu&mv=m&mvi=4&pl=24&rms=au%2Cau&siu=1&spc=jlWavVATAGORB8EudehnHvIVrE57gZ-QxXQkH9CuthTCgQ_no3eP&svpuc=1&ns=dFEMn7i0_Ifk0E4EiBMLD2wU&sabr=1&rqh=1&mt=1777102867&fvip=5&keepalive=yes&fexp=51565116%2C51565682%2C51869322&c=WEB&n=1UHZKYgXbpjzeA&sparams=expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Cxpc%2Csiu%2Cspc%2Csvpuc%2Cns%2Csabr%2Crqh&sig=AHEqNM4wRgIhAI58_JZ-d_10ev4xQ3Vr_WzxRusVPXEq8qg06_B2-vn1AiEA_2mj8Jah6Wng6QFSRj13MNDgC8l850SbPX-Q3Ufj5Co%3D&lsparams=cps%2Cmet%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms&lsig=APaTxxMwRQIhAIN5Hrlq1rotIIgwf9JwpxkZuSYqErNPhXo2a1p2wgboAiBMNJMx03dvRtr3pD6qTlyPrecN7cn5jOkzgjJ_hu8arQ%3D%3D&cpn=Xm8ydOA0clMv9oZM&cver=2.20260424.01.00&fallback_count=1&rn=18&alr=yes' from origin 'https://www.youtube.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    rr5---sn-a5mekndl.googlevideo.com/videoplayback?expire=1777124913&ei=0XHsaYSeJtaVhcIPo4uQ-AE&ip=84.47.253.159&id=o-AL4hbjGW0I0Eb5ZDr6Hz2QP4UTrIa9yk5eoc1kiuAROJ&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=178&met=1777103313%2C&mh=no&mm=31%2C29&mn=sn-vgqsrndl%2Csn-a5mekndl&ms=au%2Crdu&mv=m&mvi=4&pl=24&rms=au%2Cau&siu=1&spc=jlWavVATAGORB8EudehnHvIVrE57gZ-QxXQkH9CuthTCgQ_no3eP&svpuc=1&ns=dFEMn7i0_Ifk0E4EiBMLD2wU&sabr=1&rqh=1&mt=1777102867&fvip=5&keepalive=yes&fexp=51565116%2C51565682%2C51869322&c=WEB&n=1UHZKYgXbpjzeA&sparams=expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Cxpc%2Csiu%2Cspc%2Csvpuc%2Cns%2Csabr%2Crqh&sig=AHEqNM4wRgIhAI58_JZ-d_10ev4xQ3Vr_WzxRusVPXEq8qg06_B2-vn1AiEA_2mj8Jah6Wng6QFSRj13MNDgC8l850SbPX-Q3Ufj5Co%3D&lsparams=cps%2Cmet%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms&lsig=APaTxxMwRQIhAIN5Hrlq1rotIIgwf9JwpxkZuSYqErNPhXo2a1p2wgboAiBMNJMx03dvRtr3pD6qTlyPrecN7cn5jOkzgjJ_hu8arQ%3D%3D&cpn=Xm8ydOA0clMv9oZM&cver=2.20260424.01.00&fallback_count=1&rn=18&alr=yes:1 Failed to load resource: net::ERR_FAILED

  27. Feiabyte commented on Apr 25, 2026

    @Feiabyte
    Author

    @Feiabyte the absent connect_data preread: log line either means (a) the optimization is silently disabled, or (b) you haven't crossed the 100-event reporting threshold, or (c) your log_level is below info.

    Quick checks:

    1. log_level. The summary emits at info level. Open config.json (or the UI's Advanced section) — if log_level is set to warn / error, the line gets filtered out before display. Default is info; only worth checking if you bumped it.

    2. Mode. connect_data preread: only emits in Full Tunnel mode (mode: "full"). It's a tunnel-mux feature; apps_script mode doesn't run TunnelMux at all. If you're using apps_script (the default), you'll never see it. The "noticeably faster" you observed in apps_script is from PR #151's range-stitching cap and just baseline cumulative improvements, not connect_data.

    3. Reporting threshold. The summary fires every 100 connect/connect_data events. New connections, not requests — so loading 50 different sites = roughly 50 events. If you're using sustained connections (one big YouTube stream = ~5 connections), you might genuinely not have hit 100 yet.

    4. Server-side support. Even if all of the above check out, connect_data only wins when both the client (v1.4.0+) AND the deployed CodeFull.gs + tunnel-node understand the new op. If you're hitting an older deployment, the very first connect_data attempt gets UNSUPPORTED_OP, the sticky AtomicBool flips, and every subsequent session falls back to the legacy path. You'd see this as skip(unsup): N in the summary IF the summary was printed — but it only prints once per 100 events. To redeploy:

    • On your VPS: pull this repo's latest tunnel-node/, rebuild + restart it
    • In Apps Script editor: copy the new assets/apps_script/CodeFull.gs over your existing one, then Deploy → Manage deployments → Edit (pencil) → Version: New version → Deploy

    Quick way to force-emit the summary for visibility: load 100+ small pages in a row. Or temporarily set log_level: "debug" in config — that prints individual connect_data decisions per session, not just the every-100 summary. Lots of noise, but you'll see whether the optimization is firing at all.

    If after the above the line still doesn't appear, please share:

    • A 30-second mhrv-rs.log snippet in Full mode while loading google.com
    • Your config.json (auth_key redacted)
    • Whether your tunnel-node + CodeFull.gs are on the v1.4.0+ versions

    [reply via Anthropic Claude | reviewed by @therealaleph]

    I've already done all of the things you mentioned before, the only thing that might be the case is that I might not have reached the reporting threshold
    if I put it to debug mode what should I look for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions