Policies and rules

This document explains how to configure policies and rules to control your outbound agentic and non-agentic web traffic with Secure Web Proxy. You can control which traffic is allowed or denied based on various criteria, ensuring only authorized traffic leaves your network. Secure Web Proxy provides three primary mechanisms for defining these controls: authorization policies, gateway security policies and rules, and service rate limiting policies.

Use the appropriate policy type

To secure outbound traffic with Secure Web Proxy, choose the policy mechanism that best suits your appropriate traffic type:

  • Agentic AI traffic: when deploying Secure Web Proxy as an Agent Gateway, you can configure all security controls on the agentGateway resource by using authorization policies with extension bindings. This lets you enforce Model Context Protocol (MCP) method-level restrictions, verify agent identity, and invoke external security services like Model Armor and Identity-Aware Proxy (IAP). Any policies that are directly attached to the underlying Gateway resource are ignored.

  • Standard web traffic: when using Secure Web Proxy as an outbound proxy for non-agentic workloads, configure either an authorization policy or a gateway security policy directly on the Gateway resource:

These policy models are mutually exclusive on a single gateway. In addition to choosing your primary security policy, you can optionally configure the following type of policy:

  • Service rate limiting policy: use this policy type to prioritize traffic, protect external destinations from traffic overloads, and control the costs of outbound web traffic by limiting request counts. You can attach a service rate limiting policy to a gateway that uses either an authorization policy or a gateway security policy.

Authorization policies

Authorization policies let you establish identity-based access control checks when processing outbound requests through Secure Web Proxy. You can configure authorization policies (AuthzPolicy) to validate the identity of a source workload or agent that accesses the internet.

An authorization policy lets you specify conditions to allow, deny, or delegate request authorization based on their source, destination, and other request attributes. Requests that pass these checks are forwarded to the web destination. Requests that fail are rejected with a 403 Forbidden error.

For Secure Web Proxy, you can attach authorization policies to your gateway resource to define the security perimeter for your outbound traffic and evaluate authorization policy rules in Secure Web Proxy. In addition, you can configure Secure Web Proxy to delegate authorization decisions to an external authorization engine by using Service Extensions (authorization extensions).

For more information about how to configure authorization policies, see Set up authorization policies for Secure Web Proxy.

Authorization policies provide the following benefits over standard gateway security policies:

  • Consistent policy surface: use the unified AuthzPolicy API to manage traffic authorization for Secure Web Proxy along with other services such as Application Load Balancer and Cloud Service Mesh (CSM).

  • Service Extensions support: use Service Extensions to delegate authorization decisions to your custom logic. You can use authorization extensions to perform request-level authorization (based on headers, identity, and more) and content sanitization (such as sensitive data protection or threat detection).

  • Identity-centric security: while still supporting IP-based rules, authorization policies provide a more robust security posture by letting you enforce controls based on identity. You can define your security perimeter by using service accounts, tags, or frontend mutual TLS. You can also use Service Extensions to delegate authorization decisions to identity-based services like IAP.

Security and governance with Agent Gateway

When you deploy Secure Web Proxy as an Agent Gateway, you configure all governance policies on the agentGateway resource rather than on the underlying proxy. Secure Web Proxy evaluates only the policies that are explicitly attached to the agentGateway resource. The proxy ignores any policies that are directly attached to the underlying Gateway resource.

Agent Gateway governance uses the following two-tier policy architecture:

  1. Extension bindings (primary governance mechanism): extension bindings in Service Extensions are the primary mechanism to govern agentic traffic. You can attach managed security services directly to your agentGateway resource to inspect, authenticate, and sanitize agent communications in the following ways:

    • Model Armor: performs deep payload inspection to scan prompts and responses for sensitive data, jailbreaks, and prompt injection attacks. For more information, see Delegate authorization to Model Armor.
    • IAP: cryptographically verifies client and agent identities before forwarding tool calls to backend resources. For more information, see Delegate authorization to IAP.
  2. Authorization policies (fine-grained control, exceptions, and bypasses): authorization policies complement extension bindings by providing granular L4 and L7 rule evaluation:

    • TLS inspection bypass: configure network-level (L4) rules to bypass TLS interception for trusted external endpoints where deep inspection isn't required.
    • MCP method and tool restrictions: enforce HTTP-level (L7) rules to restrict MCP method actions, such as allowing only approved tools or restricting specific tool parameters.

Gateway security policies and rules

A gateway security policy is the core security item that defines access controls for all outbound non-agentic web traffic.

Gateway security policies include the following key features:

  • Policy control: a policy contains the gateway security rules that the proxy uses to allow or deny a web request. You can create a single policy and reuse it across multiple Secure Web Proxy instances to keep your security rules consistent and efficient.

  • Secure by default: gateway security policies are deny-all by default. The proxy blocks every HTTP and HTTPS request until you create a specific rule to permit it. This enforces a zero-trust architecture from the start.

  • Policy logic: every policy is built on two core checks: determine the traffic source and verify the allowed destination.

A gateway security rule is an instruction in a gateway security policy that matches and defines the final action: allow or deny.

Your Secure Web Proxy instance evaluates rules based on priority, with the lowest number checked first. The proxy stops and acts on the first rule that matches the request.

  • Session Matcher: checks basic information about the network connection as it's being set up. Session Matcher includes the following items:

    • Source identity (service account or secure tag)
    • Destination hostname (the domain name)
    • Destination port
  • Application Matcher: inspects the content of the actual web request. It's typically used to ensure granular control and requires TLS inspection to check encrypted traffic. Application Matcher includes the following items:

    • Full URL path
    • Request method—for example, block all DELETE actions
    • Specific HTTP headers

Service rate limiting policies

Service rate limiting policies help keep your outbound web traffic gateways resilient. Although other traffic management mechanisms prioritize scaling resources, rate limiting throttles resource-intensive clients at the source to maximize gateway availability.

Secure Web Proxy enforces service rate limiting at the end of the request processing path, after all gateway security rules, authorization checks, and service extensions complete successfully. This helps ensure that only authorized and trusted traffic consumes your rate limit budget.

For more information about how to set up rate limiting policies, see Service rate limiting overview and Configure service rate limiting policies.

Limitations

When you configure policies in Secure Web Proxy, the following limitations apply:

  • Gateway security policies: these policies don't support authorization extensions. Advanced capabilities like using custom logic or delegating authorization decisions to external services are available only through authorization policies.

  • Authorization policies: these policies don't support URL lists or regular expression (regex) matching for URL strings.

  • Service rate limiting policies: rate limiting applies only to Layer 7 traffic that matches a rule with an application attribute (ApplicationMatcher). For outbound web traffic that matches a rule with only a session attribute (SessionMatcher), rate limiting isn't applied.

What's next