Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions develop-docs/sdk/foundations/client/data-collection/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,10 @@ All header key names are always present in events. This configuration sends real
init({
dsn: "...",
dataCollection: {
httpHeaders: { allow: ["x-request-id", "x-trace-id", "content-type"] },
httpHeaders: {
request: { allow: ["x-request-id", "x-trace-id", "content-type"] },
response: { allow: ["x-request-id", "x-trace-id", "content-type"] },
},
},
});
```
Expand All @@ -690,7 +693,10 @@ Extend the sensitive denylist with GDPR-sensitive headers that may carry user-id
init({
dsn: "...",
dataCollection: {
httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
httpHeaders: {
request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
urlQueryParams: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
Expand Down Expand Up @@ -720,7 +726,10 @@ init({
},
databaseQueryData: false,
queues: false,
httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
httpHeaders: {
request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
urlQueryParams: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _Import name: `Sentry.httpClientIntegration`_

This integration captures errors on failed requests from Fetch and XHR and attaches request and response information.

By default, error events don't contain header or cookie data. You can control this with the <PlatformLink to="/configuration/options/#dataCollection">`dataCollection`</PlatformLink> option. Set `dataCollection: { httpHeaders: true, cookies: true }` in your root `Sentry.init({})` config. The deprecated `sendDefaultPii: true` option also enables this behavior.
By default, error events don't contain header or cookie data. You can control this with the <PlatformLink to="/configuration/options/#dataCollection">`dataCollection`</PlatformLink> option. Set `dataCollection: { httpHeaders: { request: true, response: true }, cookies: true }` in your root `Sentry.init({})` config. The deprecated `sendDefaultPii: true` option also enables this behavior.

<PlatformContent includePath="configuration/http-client" />

Expand Down Expand Up @@ -63,6 +63,6 @@ Default: `[/.*/]`
integration!
</Alert>

Controls header and cookie collection for this integration. Use `dataCollection: { httpHeaders: true, cookies: true }` in `Sentry.init` to capture headers and cookies on failed requests. See the <PlatformLink to="/configuration/options/#dataCollection">`dataCollection` option</PlatformLink> for the full set of controls including allow/deny lists.
Controls header and cookie collection for this integration. Use `dataCollection: { httpHeaders: { request: true, response: true }, cookies: true }` in `Sentry.init` to capture headers and cookies on failed requests. See the <PlatformLink to="/configuration/options/#dataCollection">`dataCollection` option</PlatformLink> for the full set of controls including allow/deny lists.

The deprecated `sendDefaultPii: true` option also enables this behavior.
7 changes: 5 additions & 2 deletions docs/platforms/javascript/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ Sentry.init({
userInfo: false,
genAI: { inputs: false, outputs: false },
httpBodies: [],
httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
httpHeaders: {
request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
urlQueryParams: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
Expand Down Expand Up @@ -154,7 +157,7 @@ For more on what data Sentry collects and how to control it, see <PlatformLink t
| `stackFrameVariables` | `boolean` | `true` | Capture local variable values in stack frames. |
| `frameContextLines` | `number` | `5` | Source code lines captured around each stack frame. |

The `cookies`, `httpHeaders`, and `urlQueryParams` categories accept a `CollectBehavior` value:
The `cookies` and `urlQueryParams` categories accept a `CollectBehavior` value. The `httpHeaders.request` and `httpHeaders.response` fields each accept a `CollectBehavior` value, so you can configure request and response headers independently.

```typescript
type CollectBehavior = boolean | { allow: string[] } | { deny: string[] };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Regardless of these options, you can always scrub any data before it's sent to S

By default, the Sentry SDK sends HTTP request and response headers.

Use the `dataCollection.httpHeaders` option to control this. For example, set `dataCollection: { httpHeaders: false }` to disable it, or use `{ allow: [...] }` or `{ deny: [...] }` to restrict which header values are sent. Values whose keys match Sentry's built-in sensitive denylist (such as `auth`, `token`, or `password`) are automatically scrubbed, while the keys are kept.
Use the `dataCollection.httpHeaders` option to control this. Configure `request` and `response` separately with `false`, `{ allow: [...] }`, or `{ deny: [...] }`. Values whose keys match Sentry's built-in sensitive denylist (such as `auth`, `token`, or `password`) are automatically scrubbed, while the keys are kept.

## Cookies

Expand Down Expand Up @@ -59,7 +59,10 @@ Even when this is disabled, IP addresses can still reach Sentry through collecte
Sentry.init({
dsn: "___PUBLIC_DSN___",
dataCollection: {
httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
httpHeaders: {
request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
urlQueryParams: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},
Expand Down
Loading