TIPThis project is open-sourced at Tokisaki-Galaxy/cf-symbol-proxy. Feel free to give it a star!
WARNINGThe Cloudflare Cache API requires a custom domain to function. The default
*.workers.devdomains do not support persistent caching.
Say Goodbye to Slow WinDbg Loading: Why is it always so slow?
Many Windows developers and security researchers have experienced WinDbg hanging while loading symbols. The Microsoft Symbol Server (msdl.microsoft.com) can be highly unstable in certain regions (like China), and downloading a single PDB file often takes an eternity.
I developed the cf-symbol-proxy project to build a lightweight symbol proxy using Cloudflare Workers. This significantly boosts download speeds and resolves symbol loading latency.
Why Choose Cloudflare Workers?
- Global Acceleration: Leverage Cloudflare’s edge nodes to process requests at the location closest to you.
- Generous Free Tier: 100,000 free requests per day, which is more than enough for individual developers.
- Edge Caching (Cache API): Symbol files (PDBs) are immutable. Once cached, subsequent downloads are nearly instantaneous.
- Zero Maintenance: No need to buy servers or worry about DevOps.
Highlights
Deeply optimized for the specific behaviors of the Microsoft Symbol Server:
- Fixing 0-byte Pollution: Microsoft servers often respond to
HEADrequests with a200 OKbut empty content. The proxy forces the origin fetch to useGETto ensure the cache contains the complete file. - Smart Caching:
200 OKresponses are cached for one year, while404 Not Foundresponses are cached for one hour to prevent WinDbg from frequently retrying missing files. - Automatic Deployment: Integrated with GitHub Actions; code is automatically deployed upon pushing.
- Environment Decoupling: The upstream address can be configured via
wrangler.toml, supporting various symbol sources.
Quick Deployment Guide
You can directly fork my repository to launch your own proxy:
- (Optional) Fork the Repo: Visit Tokisaki-Galaxy/cf-symbol-proxy.
- Configure Auto-Build: In the Cloudflare Workers dashboard, create a new Worker, select GitHub as the source, connect to your repository, and set up automatic deployment.
- (Optional) Modify
wrangler.toml: Change theupstreamfield to the symbol server address you wish to proxy.
Usage
Once deployed, you simply need to set your symbol path in the Windows Environment Variables.
Variable Name: _NT_SYMBOL_PATH
Variable Value:
srv*D:\Symbols*https://your-custom-domain.comTechnical Ramblings
During implementation, I encountered a peculiar issue: The conflict between HEAD requests and cache keys.
The Cloudflare Cache API treats requests based on their HTTP method by default. If WinDbg sends a HEAD request to check if a file exists and the proxy script simply forwards it, Microsoft returns a 0-byte response. If this 0-byte response gets cached, subsequent legitimate GET requests for the download will also receive 0 bytes.
The solution was:
// Force the use of GET to construct the cache keyconst cacheKey = new Request(url.toString(), { method: 'GET' });By forcing the cache key to always use GET, we ensure that regardless of what the client sends, what we store in the edge node is always the actual file data.