English Version | 中文版本
A secure, optimized Telegram Web client reverse proxy solution deployed on Cloudflare Workers.
- 🔒 Security Optimized: Multi-layer security protection to reduce the risk of being flagged as malicious
- 🚀 Performance Optimized: Smart path mapping and caching strategies
- 🛡️ Anti-Bot Protection: Basic User-Agent checking and access control
- 🌐 CORS Support: Complete Cross-Origin Resource Sharing configuration
- 📱 WebSocket Support: Full support for Telegram's real-time communication
- Changed obvious Telegram-related paths to more generic names
- Uses
/api/and/cdn/prefixes instead of obvious identifiers
- Added comprehensive security HTTP headers
- Includes CSP, HSTS, XSS protection, etc.
- Basic User-Agent checking
- Anti-crawler mechanisms
- IP address logging and forwarding
- More precise JavaScript code modification
- Avoids over-replacement that could break functionality
- Login to Cloudflare Dashboard
- Go to "Workers & Pages" section
- Click "Create application"
- Select "Create Worker"
- Copy the contents of
worker.jsto the Worker editor - Find the
workerDomainrelated parts in the code - Ensure domain configuration is correct
- Add your domain to Cloudflare
- Bind custom domain in Worker settings
- This avoids using
.workers.devdomain which can be easily identified
You can further customize configuration through environment variables:
ALLOWED_ORIGINS: Allowed origin domainsRATE_LIMIT: Rate limiting configuration
New path mapping is more discreet and secure:
| Original Path | New Path | Target Server |
|---|---|---|
/kws1ws/apiws |
/api/ws1 |
kws1.web.telegram.org |
/plutows/apiw1 |
/cdn/pluto |
pluto.web.telegram.org |
/assets/ |
/assets/ |
webk.telegram.org |
After deployment, users can access via:
https://your-domain.com
All Telegram Web client requests will be automatically proxied to the corresponding Telegram servers.
- Regular Updates: Keep Worker code updated
- Monitor Logs: Regularly check access logs to identify abnormal access
- Domain Protection: Use custom domains instead of default workers.dev domains
- Access Control: Add stricter access control as needed
-
Connection Failed
- Check if domain configuration is correct
- Confirm Cloudflare proxy status
-
Functionality Issues
- Check if JavaScript code replacement is correct
- View browser console error messages
-
Flagged as Dangerous Website
- Ensure using custom domain
- Check security header configuration
- Avoid obvious Telegram-related words in domain
If you encounter issues, please check:
- Cloudflare Worker logs
- Browser developer tools
- Network connection status
worker.js: Main Worker code with enhanced securitysecurity-config.js: Independent security configurationdeployment-guide.md: Detailed deployment guide (Chinese)
- ✅ Use generic domain names
- ✅ Avoid sensitive words like telegram, proxy, vpn
- ✅ Choose common TLDs (.com, .net, .org)
- ✅ Enable User-Agent checking
- ✅ Set reasonable rate limits
- ✅ Regularly check access logs
- ✅ Filter sensitive information in responses
- ✅ Add appropriate security headers
- ✅ Use HTTPS forced redirect
- ✅ Regularly update Worker code
- ✅ Monitor service availability
- ✅ Backup important configurations
- Set long-term cache for static resources
- Set short-term cache for API responses
- Use Cloudflare's edge caching
- Enable Gzip/Brotli compression
- Optimize JavaScript code size
- Use CDN for static resource acceleration
- Enable HTTP/2
- Use Keep-Alive connections
- Optimize DNS resolution
- Ensure compliance with local laws and regulations
- Do not use for illegal purposes
- Respect terms of service and usage agreements
- Take responsibility for usage consequences
This project is for educational and research purposes only. Users must comply with local laws and regulations and are responsible for the consequences of use.
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.
If you find this project helpful, please consider giving it a star ⭐