# Decide which clients may reach your models

> Restrict which clients can call your AI gateway with request-header access rules: allow/deny by User-Agent or any header, global / group / key scopes, allowlist mode, and ReDoS-safe regex.

Canonical: https://www.gatellm.io/use-cases/client-admission-control/

Request-header access rules that allow or deny by User-Agent, origin, or any header — scoped globally, to a key group, or to a single key.

## What the community actually complains about
"A leaked key means anyone with it can burn our quota," "we want to allowlist the whole company's coding agents but block bare curl and scrapers," "the vendor console has an IP allowlist, but our traffic is dynamic and proxy-fronted so it never fits."
Enforcement has to happen where the request arrives — on the gateway — not on a client-side setting a developer can just flip off.

## How GateLLM does it
GateLLM evaluates admission rules on every request against HTTP headers: six match types (exact / prefix / regex / exists / absent / any) and three scopes (global / key group / key), ordered by sort_order with first-match-wins.
For "only approved clients" you run allowlist mode: set the group's default action to deny, then add a single allow rule matching the client signature — everything else is rejected before it reaches a model.

## 5 levers that actually land
- 6 match types: exact / prefix / regex / exists / absent / any — one rule can express "A or B or C" via regex alternation
- 3 scopes: global, per key group, per key — with first-match-wins and same-order global priority
- Allowlist mode: default deny + one explicit allow — new unknown clients are rejected by default
- Rules also cover model-list routes (/v1/models), so a denied client is locked out end to end
- ReDoS-safe linear-time regex engine — pathological patterns are rejected at load time, not at request time

## FAQ
### Can a client spoof X-Forwarded-For to bypass a rule?
Yes — X-Forwarded-For is client-forgeable. It is only reliable when a trusted reverse proxy overwrites it; otherwise a malicious client fills it in arbitrarily. For real IP admission, prefer the source IP the gateway sees directly, configured with TRUSTED_PROXIES.

### Why is my client getting 403 even though the key is right?
Access rules apply to model-list routes too. A denied client may be blocked as early as its first /v1/models call. Check whether a Header ACL rule is matching, and remember that under default-deny, a client that matches no allow rule is rejected.

### Can I write "allow only if the header does NOT contain X"?
No single regex can express that — the engine has no lookahead. Orchestrate the reverse: set the default action to deny, then add one "allow if it contains X" rule. Unmatched requests fall back to default-deny.

- [Full how-to: Configure Header ACL (docs)](https://docs.gatellm.io/en/howto/configure-header-acl)

## Related
- [Home](https://www.gatellm.io/index.md)
- [Pricing](https://www.gatellm.io/pricing.md)
- [Cost Calculator](https://www.gatellm.io/calculator.md)
- [About](https://www.gatellm.io/about.md)
- [Book a Demo](https://www.gatellm.io/demo.md)
- [FAQ](https://www.gatellm.io/faq.md)
- [Compare AI Gateways](https://www.gatellm.io/compare.md)
- [Compare LiteLLM](https://www.gatellm.io/compare/litellm.md)
- [Compare OpenRouter](https://www.gatellm.io/compare/openrouter.md)
- [Compare Alibaba Cloud AI Gateway](https://www.gatellm.io/compare/alibaba-cloud.md)
- [Compare Azure API Management](https://www.gatellm.io/compare/azure-apim.md)
- [Compare Apigee](https://www.gatellm.io/compare/apigee.md)
- [Compare Cloudflare AI Gateway](https://www.gatellm.io/compare/cloudflare.md)
- [Compare Kong AI Gateway](https://www.gatellm.io/compare/kong.md)
- [Compare Portkey](https://www.gatellm.io/compare/portkey.md)
- [LiteLLM vs Kong AI Gateway](https://www.gatellm.io/compare/litellm-vs-kong.md)
- [LiteLLM vs OpenRouter](https://www.gatellm.io/compare/litellm-vs-openrouter.md)
- [LiteLLM vs Portkey](https://www.gatellm.io/compare/litellm-vs-portkey.md)
- [Use Cases](https://www.gatellm.io/use-cases.md)
- [Reduce LLM Cost](https://www.gatellm.io/use-cases/reduce-cost.md)
- [High Availability](https://www.gatellm.io/use-cases/high-availability.md)
- [Multi-Tenant Isolation](https://www.gatellm.io/use-cases/multi-tenant.md)
- [Compliance & Audit](https://www.gatellm.io/use-cases/compliance-audit.md)
- [Troubleshooting by Symptom](https://www.gatellm.io/use-cases/troubleshooting.md)
- [Mixed Multi-Vendor Model Stack](https://www.gatellm.io/use-cases/mixed-model-stack.md)
- [Self-Host AI Inside Office](https://www.gatellm.io/use-cases/self-hosted-office-ai.md)
- [Token Usage Visibility & Attribution](https://www.gatellm.io/use-cases/token-ops.md)
- [Token FinOps: AI Cost Allocation & Control](https://www.gatellm.io/use-cases/token-finops.md)
- [MCP Tool Governance](https://www.gatellm.io/use-cases/mcp-tool-governance.md)
- [Web Search for Every Model](https://www.gatellm.io/use-cases/web-search-grounding.md)
- [Multi-Key Rotation & Standby](https://www.gatellm.io/use-cases/multi-key-pooling.md)
- [Enforce Which Model Agents Actually Run](https://www.gatellm.io/use-cases/enforce-model-policy.md)
- [No Model Choice on the Client](https://www.gatellm.io/use-cases/automatic-model-tiering.md)
- [One Protocol, Any Model](https://www.gatellm.io/use-cases/one-protocol-any-model.md)
- [Office / Microsoft 365 Add-in](https://www.gatellm.io/office-addin.md)
- [Glossary](https://www.gatellm.io/glossary.md)
- [Model Catalog](https://www.gatellm.io/models.md)
- [SDK & Framework Integrations](https://www.gatellm.io/integrations.md)
- [AI Coding Agents & Harnesses](https://www.gatellm.io/coding-agents.md)
- [Security & Compliance](https://www.gatellm.io/security.md)
- [Privacy Policy](https://www.gatellm.io/privacy-policy.md)
- [Terms of Service](https://www.gatellm.io/terms.md)
- [Cookie Policy](https://www.gatellm.io/cookies.md)
- [Data Processing Agreement (DPA)](https://www.gatellm.io/dpa.md)
- [Sub-processor List](https://www.gatellm.io/subprocessors.md)
- [Security Questionnaire (CAIQ/SIG/VSA)](https://www.gatellm.io/trust.md)
- [Incident Response & Support](https://www.gatellm.io/sla.md)
- [Vulnerability Disclosure Policy](https://www.gatellm.io/vulnerability-disclosure.md)
- [Open Source License Notice](https://www.gatellm.io/open-source-licenses.md)
- [Version Support & Lifecycle (EOL)](https://www.gatellm.io/lifecycle.md)
- [Engineering Blog](https://www.gatellm.io/blog.md)
- [Your Agents Have More Permissions Than Your Employees: Governing MCP Tools at the Gateway](https://www.gatellm.io/blog/mcp-tool-governance.md)
- [The $10k Invoice Problem: Five Ways to Cut LLM Spend Without Dumbing Down Your App](https://www.gatellm.io/blog/reduce-cost.md)
- [Your Vendor's List Price Is Not Your Cost: Applying Real FinOps to Token Spend](https://www.gatellm.io/blog/token-finops.md)
- [llms.txt](https://www.gatellm.io/llms.txt)
