Skip to content

Commit 71837eb

Browse files
authored
[AI Gateway] Document DLP interaction with caching (#30906)
1 parent 1c4e7a9 commit 71837eb

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • src/content/docs/ai-gateway/features/dlp

src/content/docs/ai-gateway/features/dlp/index.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ Because of this buffering:
5555
- **Request-only DLP scanning** (where the **Check** setting is set to **Request**) does not buffer the response and has no impact on streaming latency.
5656
- If you need low-latency streaming for certain requests while still using DLP on the same gateway, consider setting the DLP policy **Check** to **Request** only, or use separate gateways for latency-sensitive and DLP-scanned traffic.
5757

58+
### Interaction with caching
59+
60+
DLP scanning runs after a cache miss, when AI Gateway forwards the request to the provider and receives a response. The following table describes how each DLP outcome affects caching:
61+
62+
| DLP outcome | Response cached | Behavior |
63+
| --- | --- | --- |
64+
| Pass (no findings) | Yes | The response is cached normally according to your gateway cache settings. |
65+
| Flag | Yes | The response is cached normally. DLP findings are attached to the `cf-aig-dlp` response header and recorded in logs, but the original response is returned to the client. |
66+
| Block | No | The provider response is discarded and replaced with a DLP error response (status `400`). |
67+
68+
**Cache hits skip DLP scanning.** When a subsequent identical request matches a cached response, AI Gateway serves it directly from cache without re-running DLP. This is safe because only responses that already passed DLP (or were flagged, not blocked) are cached. However, if you update your DLP policies after a response has been cached, the cached response is not re-evaluated. It continues to be served until the cache TTL expires.
69+
70+
If you need DLP policy changes to take effect immediately, you can bypass the cache for new requests using the `cf-aig-skip-cache` header. For more information, refer to [Caching](/ai-gateway/features/caching/).
71+
5872
### Per-request DLP controls
5973

6074
DLP policies are configured at the gateway level and apply uniformly to all requests passing through that gateway. There is no per-request header to select specific DLP profiles or to bypass DLP scanning for individual requests.

0 commit comments

Comments
 (0)