Skip to content

feat(sdk): add L7 request matchers and forward URLs to network policies#173

Merged
QuiiBz merged 2 commits into
named-sandboxesfrom
sdk/l7-matchers-forwardurl
May 6, 2026
Merged

feat(sdk): add L7 request matchers and forward URLs to network policies#173
QuiiBz merged 2 commits into
named-sandboxesfrom
sdk/l7-matchers-forwardurl

Conversation

@QuiiBz
Copy link
Copy Markdown
Member

@QuiiBz QuiiBz commented May 6, 2026

This PR adds support for L7 requests matcher and forward URLs in network policies

⚠️ A follow-up PR will update to support the V2 API schema for network policies, which will clean up the toAPINetworkPolicy / fromAPINetworkPolicy logic

Request matchers

For each NetworkPolicyRule, you can apply a matcher on:

  • the request method
  • the request path
  • the request query strings
  • the request headers

Each matcher can target to either exactly match, start with, or regex match, a provided value. For example, to inject an authorization header on requests to Vercel's AI gateway but only on specific requests:

allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}

Forward URLs

For each NetworkPolicyRule, you can define a forwardURL field that serves as an HTTPS proxy to forward matching requests to. Since it's a NetworkPolicyRule, you can also define matchers on it:

allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sandbox Ready Ready Preview, Comment, Open in v0 May 6, 2026 1:18pm
sandbox-cli Ready Ready Preview, Comment May 6, 2026 1:18pm
sandbox-sdk Ready Ready Preview, Comment May 6, 2026 1:18pm
sandbox-sdk-ai-example Ready Ready Preview, Comment May 6, 2026 1:18pm
workflow-code-runner Ready Ready Preview, Comment May 6, 2026 1:18pm

Request Review

@QuiiBz QuiiBz merged commit 0c62cab into named-sandboxes May 6, 2026
14 checks passed
@QuiiBz QuiiBz deleted the sdk/l7-matchers-forwardurl branch May 6, 2026 13:48
QuiiBz added a commit that referenced this pull request May 6, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
@github-actions github-actions Bot mentioned this pull request May 7, 2026
LukeSheard pushed a commit that referenced this pull request May 7, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 7, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
QuiiBz added a commit that referenced this pull request May 8, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to named-sandboxes,
this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`named-sandboxes` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `named-sandboxes`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @vercel/sandbox@2.0.0-beta.18

### Minor Changes

- Add L7 request matchers and forward URLs support to network policy
rules. ([#173](#173))

## sandbox@3.0.0-beta.20

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## sandbox-filesystem-snapshots@0.0.17-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## workflow-code-runner@0.1.6-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to named-sandboxes,
this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`named-sandboxes` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `named-sandboxes`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @vercel/sandbox@2.0.0-beta.18

### Minor Changes

- Add L7 request matchers and forward URLs support to network policy
rules. ([#173](#173))

## sandbox@3.0.0-beta.20

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## sandbox-filesystem-snapshots@0.0.17-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## workflow-code-runner@0.1.6-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to named-sandboxes,
this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`named-sandboxes` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `named-sandboxes`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @vercel/sandbox@2.0.0-beta.18

### Minor Changes

- Add L7 request matchers and forward URLs support to network policy
rules. ([#173](#173))

## sandbox@3.0.0-beta.20

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## sandbox-filesystem-snapshots@0.0.17-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## workflow-code-runner@0.1.6-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to named-sandboxes,
this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`named-sandboxes` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `named-sandboxes`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @vercel/sandbox@2.0.0-beta.18

### Minor Changes

- Add L7 request matchers and forward URLs support to network policy
rules. ([#173](#173))

## sandbox@3.0.0-beta.20

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## sandbox-filesystem-snapshots@0.0.17-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## workflow-code-runner@0.1.6-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to named-sandboxes,
this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`named-sandboxes` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `named-sandboxes`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @vercel/sandbox@2.0.0-beta.18

### Minor Changes

- Add L7 request matchers and forward URLs support to network policy
rules. ([#173](#173))

## sandbox@3.0.0-beta.20

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## sandbox-filesystem-snapshots@0.0.17-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## workflow-code-runner@0.1.6-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
LukeSheard pushed a commit that referenced this pull request May 11, 2026
…es (#173)

This PR adds support for L7 requests matcher and forward URLs in network
policies

⚠️ A follow-up PR will update to support the V2 API schema for network
policies, which will clean up the `toAPINetworkPolicy` /
`fromAPINetworkPolicy` logic

### Request matchers

For each `NetworkPolicyRule`, you can apply a matcher on:
- the request method 
- the request path
- the request query strings
- the request headers

Each matcher can target to either exactly match, start with, or regex
match, a provided value. For example, to inject an authorization header
on requests to Vercel's AI gateway but only on specific requests:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}
```

### Forward URLs

For each `NetworkPolicyRule`, you can define a `forwardURL` field that
serves as an HTTPS proxy to forward matching requests to. Since it's a
`NetworkPolicyRule`, you can also define matchers on it:

```
allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      forwardURL: 'https://my-proxy.vercel.app'
    }
  ],
  "*": []
}
```
LukeSheard pushed a commit that referenced this pull request May 11, 2026
Follow-up to #173, update the
network policies requests to use the V2 schema, which supports matchers
and forward URLs

For now, the API responses are still under the V1 schema, because
changing it would be a breaking change. Only the requests are using the
V2 schema with this PR, which greatly simplifies `toAPINetworkPolicy`
LukeSheard pushed a commit that referenced this pull request May 11, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to named-sandboxes,
this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`named-sandboxes` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `named-sandboxes`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @vercel/sandbox@2.0.0-beta.18

### Minor Changes

- Add L7 request matchers and forward URLs support to network policy
rules. ([#173](#173))

## sandbox@3.0.0-beta.20

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## sandbox-filesystem-snapshots@0.0.17-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

## workflow-code-runner@0.1.6-beta.0

### Patch Changes

- Updated dependencies
\[[`0c62cab5ab16af355ca57d1a19ab1e6e70899060`](0c62cab)]:
    -   @vercel/sandbox@2.0.0-beta.18

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants