How to set up proxying for multiple Telegram P2P windows with different proxy servers?
Problem: When using multiple Telegram accounts with P2P platforms, all windows use the same msedgewebview2.exe process, which doesn’t allow binding different proxies to each window.
Current setup:
- Telegram account with proxy through Proxifier
- P2P platforms open through separate msedgewebview2.exe process
- All P2P windows have the same process
Tried solutions without success:
- Cloud phones
- Browser profiles (ADSpower, MoreLogin, GeeLark)
Problems with these solutions:
- Telegram detects the same proxy for all P2P platforms
- Verifications happen simultaneously for all platforms
Requirements:
- Tool to bind a separate proxy to each P2P window
- Solution that bypasses Telegram’s detection of working under one proxy
Important details:
- Telegram web version doesn’t work (no P2P support)
- All accounts work through portable version
Setting Up Proxying for Multiple Telegram P2P Windows with Different Proxy Servers
To configure proxying for multiple Telegram P2P windows with different proxy servers, it’s necessary to solve the msedgewebview2.exe process isolation problem, which prevents binding a separate proxy to each instance. There are several approaches to achieving full isolation between accounts.
Table of Contents
- Main Methods for Solving the Isolation Problem
- Using Portable Versions of Telegram with Separate TData
- Setting Up WebView2 Process Isolation
- Proxy Solutions with Virtual Machines
- Tools for Automating Isolation
- Practical Implementation
- Performance Optimization
Main Methods for Solving the Isolation Problem
The problem is that all instances of Telegram Desktop use the same msedgewebview2.exe process, which results in the same proxy being detected for all P2P platforms. To solve this problem, it’s necessary to ensure complete isolation of each instance.
According to research, there are several approaches:
- Running separate instances with unique TData folders
- Using isolated environments for each account
- Setting up different proxies at the operating system level
- Virtualization for maximum isolation
Important: As noted in the sources, for maximum account separation, virtual machines should be used, providing the highest level of isolation.
Using Portable Versions of Telegram with Separate TData
The portable version of Telegram allows running multiple instances with isolated data. To do this:
-
Create separate folders for each account:
Telegram_Account1\ Telegram_Account2\ Telegram_Account3\ -
Copy the portable version of Telegram into each folder
-
For each instance, configure individual proxies through system settings or Proxifier
Research shows that this method allows running multiple independent Telegram instances, but the problem with the shared msedgewebview2.exe process remains.
Setting Up WebView2 Process Isolation
The msedgewebview2.exe process is a component of Microsoft Edge WebView2 that uses a site-isolated process model. To solve the isolation problem:
-
Separation of user data: Each Telegram instance should correspond to a separate WebView2 user data store
-
Startup parameter configuration: Use isolation flags when launching:
--user-data-dir="C:\path\to\unique\data\folder" --disable-web-security --disable-features=IsolateOrigins,site-per-process -
Process isolation: According to Microsoft documentation, WebView2 uses a multi-process model for improved reliability, security, and performance
Research shows that when running multiple WebView2 instances with different user data folders, processes should be isolated, but in practice, this doesn’t always work correctly.
Proxy Solutions with Virtual Machines
The most reliable solution is to use virtual machines for each account:
-
VM Setup: Create a separate virtual machine for each Telegram account
-
Network Isolation: Configure a different proxy server for each VM
-
Hardware Acceleration: Use GPU virtualization for improved performance
-
Automation: Set up automatic startup and management of VMs
As noted in research, virtual machines provide the highest level of isolation and allow Telegram to avoid detecting that it’s running under the same proxy.
Tools for Automating Isolation
To automate the isolation process, you can use the following tools:
1. Batch scripts with process isolation
@echo off
setlocal
:: Launch first instance with proxy 1
start "" "Telegram1\Telegram.exe" --msedge-path="Telegram1\msedgewebview2.exe" --user-data-dir="Telegram1\userdata"
:: Launch second instance with proxy 2
start "" "Telegram2\Telegram.exe" --msedge-path="Telegram2\msedgewebview2.exe" --user-data-dir="Telegram2\userdata"
endlocal
2. Proxy managers
- Proxifier: Configure routing rules for each instance
- ProxyCap: Create separate tunnels for each process
- Clash for Windows: Use multi-port mode for isolation
3. Containers and sandboxes
- Docker: Run each instance in a separate container
- Sandboxie: Isolate each process in a sandbox
Practical Implementation
Here’s a step-by-step guide for setting up isolated instances:
-
Environment Preparation:
- Install the portable version of Telegram
- Create a folder structure for each account
- Set up proxy servers for each instance
-
Launch Configuration:
batch@echo off REM Telegram Account 1 start "" "Telegram1\Telegram.exe" --user-data-dir="Telegram1\userdata" --msedge-path="Telegram1\msedgewebview2.exe" REM Telegram Account 2 start "" "Telegram2\Telegram.exe" --user-data-dir="Telegram2\userdata" --msedge-path="Telegram2\msedgewebview2.exe" -
Proxy Configuration:
- For each instance, configure a separate proxy in Proxifier
- Use different ports for each process
-
Isolation Verification:
- Launch Task Manager and check for separate msedgewebview2.exe processes
- Ensure each process is using its own proxy
Performance Optimization
To optimize the operation of multiple instances:
-
Resource Management:
- Limit the number of simultaneous instances
- Configure process priorities
- Use SSD disk space for faster operation
-
Monitoring:
- Use Process Hacker to monitor process isolation
- Set up alerts when shared resources are detected
-
Automatic Recovery:
- Set up restarting of frozen instances
- Use scripts to automatically verify isolation
Conclusion
To set up proxying for multiple Telegram P2P windows with different proxy servers, it’s necessary to:
- Use portable versions of Telegram with completely isolated TData folders for each account
- Configure separate msedgewebview2.exe instances with different paths to executable files
- Apply system proxy managers to route traffic for each instance through a separate proxy
- For maximum isolation, it’s recommended to use virtual machines
- Automate the launch and monitoring process to ensure stable operation
The key factor for success is the complete separation of msedgewebview2.exe processes between accounts, which allows Telegram to avoid detecting that it’s running under the same proxy and ensures independent operation of each P2P platform.
Sources
- How to Run Multiple Telegram Accounts on One Device: A Step-by-Step Guide
- Process model for WebView2 apps - Microsoft Edge Developer documentation
- WebView2 end-user FAQ - Microsoft Edge Developer documentation
- Multiple WebView2 instances of different processes that share user data folders cannot run at the same time!
- Multiple instances of “Microsoft Edge WebView2” constantly running while MailWasher is in the background
- msedgewebview2.exe Windows process - What is it?
- How can I run multiple instances of Telegram? - Ask Ubuntu
- Multiple instances · Issue #533 · telegramdesktop/tdesktop