Documentation Index
Fetch the complete documentation index at: https://docs.esperr.com/llms.txt
Use this file to discover all available pages before exploring further.
What is a User Agent?
The User-Agent string tells servers what software is making the request - browser, app, bot, or tool. It’s like an ID badge that describes the client’s identity.MDN Web DocsRead more on User-Agent.
Anatomy of a User-Agent String
Mozilla/5.0- Historical compatibility tokenWindows NT 10.0; Win64; x64- Operating systemAppleWebKit/537.36- Rendering engineChrome/91.0.4472.124- Browser and versionSafari/537.36- Compatibility indicator
Common User-Agent Types
Legitimate Browsers
Mobile Apps
Bots & Crawlers
Automated Tools
Using User-Agent in Policies
Esper supports string matching on User-Agent values with:equalsnot equalscontainsstarts withends with
Basic Examples
Block known bad bots:Advanced Patterns
Require modern browsers:Traffic Protection TipMany malicious bots use fake or outdated User-Agent strings. Look for inconsistencies like Chrome version 40 (from 2015) or misspellings.
Security Patterns
Empty or Missing User-Agents
Suspicious Patterns
Known Attack Tools
Best Practices
DO:
- Check for empty/null - Many attacks omit User-Agent
- Validate format - Real browsers have consistent patterns
- Monitor changes - Sudden User-Agent switches are suspicious
- Allow legitimate bots - Google, Bing need access for SEO
- Log everything - User-Agents help with forensics
- Update patterns - Browsers release new versions monthly
DON’T:
- Trust blindly - User-Agents are easily spoofed
- Block all bots - Some are necessary (search engines)
- Use exact matching - Versions change frequently
- Ignore mobile - Different patterns than desktop
- Forget about apps - Native apps have custom User-Agents
Bot Management
Good Bots to Allow
| Bot | Purpose | User-Agent Pattern |
|---|---|---|
| Googlebot | Search indexing | Googlebot/ |
| Bingbot | Search indexing | bingbot/ |
| Slackbot | Link previews | Slackbot |
| FacebookBot | Social previews | facebookexternalhit |
| TwitterBot | Tweet cards | Twitterbot |
Bad Bot Indicators
- Generic:
Mozilla/5.0only - Outdated: Browser versions from years ago
- Malformed: Missing expected components
- Tools: Development/testing tools
- Suspicious: Known attack signatures
User-Agent Consistency Checks
Session Validation
Browser Feature Validation
Mobile Detection
Identifying Mobile Traffic
Tablet vs Phone
Common Attack Patterns
User-Agent Injection
Crawler Pretending to be Browser
Troubleshooting
“Blocking real users”- Check for browser updates
- Mobile apps might have custom strings
- Browser extensions can modify User-Agent
- Privacy tools randomize User-Agents
- They might rotate User-Agents
- Using real browser automation
- Copying legitimate User-Agents
- Need additional signals beyond User-Agent
Advanced Detection
Browser Fingerprinting
Combine User-Agent with:- JavaScript capabilities
- Screen resolution
- Timezone
- Installed plugins
- Canvas fingerprint
Behavioral Analysis
Related Fields
- Headers - Modern browsers send additional identity headers
- Client IP - Combine for stronger traffic protection
- Request Path - Bots often hit specific paths
- Referrer - Bots often lack proper referrers