Network authorization

Attach to:

Network authorization enforces access control at the L4 (transport) level, before HTTP processing. You can enforce policies for non-HTTP traffic such as raw TCP and TLS connections, and layer L4+L7 controls when you combine policies with HTTP authorization.

Network authorization uses CEL expressions evaluated against the connection’s source context.

Configuration

Configure network authorization as a frontend policy under frontendPolicies.networkAuthorization.

# yaml-language-server: $schema=https://agentgateway.dev/schema/config
frontendPolicies:
  networkAuthorization:
    rules:
    - allow: 'source.address == "10.0.0.0" || source.address == "10.0.0.1"'
    - deny: 'source.address == "192.168.1.100"'
    - require: 'source.port > 1024'

binds:
- port: 3000
  listeners:
  - routes:
    - backends:
      - host: localhost:8080

Rules

Network authorization supports the same rule types as HTTP authorization:

Rule typeBehavior
allowIf any allow rule matches, the connection is permitted.
denyIf any deny rule matches, the connection is rejected.
requireAll require rules must match for the connection to proceed.

Evaluation order:

  1. If there are no rules, the connection is allowed.
  2. If any deny rule matches, the connection is rejected.
  3. All require rules must match.
  4. If any allow rule matches, the connection is allowed.
  5. If only deny rules exist, unmatched connections are allowed (denylist semantics).
  6. If allow rules exist but none matched, the connection is rejected (allowlist semantics).

CEL context

The following CEL variables are available in network authorization rules:

VariableTypeDescription
source.addressstringIP address of the downstream connection.
source.portintPort of the downstream connection.
source.tls.identitystringClient certificate identity (if mTLS).
source.tls.subject_alt_nameslist(string)Subject Alternative Names from the client certificate.

Examples

Allow only private network ranges

frontendPolicies:
  networkAuthorization:
    rules:
    - allow: 'source.address.startsWith("10.") || source.address.startsWith("172.16.") || source.address.startsWith("192.168.")'

Require mTLS client identity

frontendPolicies:
  networkAuthorization:
    rules:
    - require: 'source.tls.identity == "spiffe://cluster.local/ns/default/sa/my-service"'

Layered L4+L7 controls

Combine network authorization with HTTP authorization for defense in depth.

frontendPolicies:
  networkAuthorization:
    rules:
    - allow: 'source.address.startsWith("10.")'

binds:
- port: 3000
  listeners:
  - routes:
    - backends:
      - host: localhost:8080
      policies:
        authorization:
          rules:
          - require: 'jwt.aud == "my-service"'

In this example, only connections from the 10.0.0.0/8 range are accepted at the network level, and those connections must also present a valid JWT with the correct audience claim.

Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.