Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(astro): Update middleware documentation #9502

Merged
merged 1 commit into from
Nov 9, 2023
Merged
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
4 changes: 2 additions & 2 deletions packages/astro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ import { sequence } from "astro:middleware";
import * as Sentry from "@sentry/astro";

export const onRequest = sequence(
Sentry.sentryMiddleware(),
// Add your other handlers after sentryMiddleware
Sentry.handleRequest(),
// Add your other handlers after Sentry.handleRequest()
);
```

Expand Down
8 changes: 6 additions & 2 deletions packages/astro/src/server/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ import type { APIContext, MiddlewareResponseHandler } from 'astro';
type MiddlewareOptions = {
/**
* If true, the client IP will be attached to the event by calling `setUser`.
* Only set this to `true` if you're fine with collecting potentially personally identifiable information (PII).
*
* This will only work if your app is configured for SSR
* Important: Only enable this option if your Astro app is configured for (hybrid) SSR
* via the `output: 'server' | 'hybrid'` option in your `astro.config.mjs` file.
* Otherwise, Astro will throw an error when starting the server.
*
* Only set this to `true` if you're fine with collecting potentially personally identifiable information (PII).
*
* @default false (recommended)
*/
trackClientIp?: boolean;

/**
* If true, the headers from the request will be attached to the event by calling `setExtra`.
*
* Only set this to `true` if you're fine with collecting potentially personally identifiable information (PII).
*
* @default false (recommended)
Expand Down