User-Agent Detect
The ua-detect analysis controller parses the HTTP User-Agent header to identify browser, OS, device type, and bots.
Configuration
yaml
analysisControllers:
- name: user-agent
type: ua-detect
# settings:
# enableFallback: true # use regex-based ua-parser when the primary parser marks UA as unknown
# cacheEnabled: true # disable to skip UA result caching (enabled by default)1
2
3
4
5
6
2
3
4
5
6
Upstream Headers Injected
Browser information
X-UA-Browser— Browser name (e.g.,Chrome)X-UA-Browser-Version— Full version stringX-UA-Browser-Major— Major versionX-UA-Browser-Minor— Minor versionX-UA-Browser-Patch— Patch version
Operating system
X-UA-OS-Name— OS name (e.g.,Windows,macOS,Linux)X-UA-OS-Version— Full OS versionX-UA-OS-Major— Major versionX-UA-OS-Minor— Minor versionX-UA-OS-Platform— Platform architecture
Device information
X-UA-Device-Type— One of:desktop,mobile,tablet,bot,tv,unknownX-UA-Device-Mobile— Boolean (true/false)X-UA-Device-Tablet— BooleanX-UA-Device-Desktop— BooleanX-UA-Device-TV— BooleanX-UA-Device-Model— Device model (when available)
Bot detection
X-UA-Bot-Name— Bot name (when detected)X-UA-Bot-URL— Bot URL/homepage
Parser Pipeline
- Primary parser:
mileusna/useragent(fast path). - Optional fallback:
ua-parser/uap-goused whenenableFallbackis true and the primary parser reports an unknown UA. - Parsed results are cached by UA string when
cacheEnabledis true (default).
Use Cases
- Block or rate-limit bots
- Device-specific access policies
- Browser compatibility checks
- Analytics and user insights
- Mobile vs desktop routing
Requirements
- None (no external dependencies)