docs: improve docs for auth-hook session variable caching

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8749
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: c685451d5c4da343a6074d3d5fd82d73f6f240b4
This commit is contained in:
paritosh-08 2023-04-19 19:00:09 +05:30 committed by hasura-bot
parent 2f7e89a9c2
commit 4a15cfae99
3 changed files with 26 additions and 14 deletions

View File

@ -237,12 +237,22 @@ auth-webhook is made after the time specified in those fields and a new websocke
::: :::
## Caching webhook session variables ## Webhook Auth Caching
<ProductBadge standard pro ee self /> <ProductBadge standard pro ee self />
Webhook session variables can be cached in order to improve performance of the request. For caching, you need to return Session variables from a webhook token can be cached to improve the performance of the request.
either:
:::info Note
- This feature is available for version `v2.22.0` and higher.
- Webhook auth caching requires a [redis instance configured](deployment/graphql-engine-flags/reference.mdx#redis-url)
with the GraphQL Engine. If the redis instance is not configured or inaccessible, then the request goes through by
skipping the cache.
:::
For caching, you need to return either:
- a `Cache-Control` variable, modeled on the - a `Cache-Control` variable, modeled on the
[Cache-Control HTTP Header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control), to specify a [Cache-Control HTTP Header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control), to specify a
@ -278,14 +288,15 @@ Content-Type: application/json
:::tip Tip :::tip Tip
The cache key is based on the following parameters: The cache key is based on the information that is sent to the auth webhook, namely the following:
- Client headers - Client headers
- Graphql request - Graphql request
This means that the cache key will change if the graphql request changes. If you want to cache auth token based on Note that the cache key will change if the GraphQL request changes even if the client headers are same. If you want to
client headers only, you can cache auth token based on client headers only, you should disable sending GraphQL request to the auth webhook using
[omit the auth-hook request body](deployment/graphql-engine-flags/reference.mdx#send-request-body-to-auth-hook). [Send Request Body to Auth Hook](deployment/graphql-engine-flags/reference.mdx#send-request-body-to-auth-hook) server
configuration.
::: :::

View File

@ -845,7 +845,8 @@ The path to a shared CA store to use to connect to both (caching and rate-limiti
### Redis URL ### Redis URL
The Redis URL to use for [query caching](/enterprise/caching.mdx). The Redis URL to use for [query caching](/enterprise/caching.mdx) and [Webhook Auth
Caching](/auth/authentication/webhook.mdx#webhook-auth-caching).
| | | | | |
| ------------------- | ---------------------------------------- | | ------------------- | ---------------------------------------- |

View File

@ -102,6 +102,12 @@ import Enterprise from '@site/static/icons/features/enterprise.svg';
</p> </p>
</div> </div>
</VersionedLink> </VersionedLink>
<VersionedLink to="/auth/authentication/webhook/#webhook-auth-caching">
<div className="card">
<h3>Webhook Auth Caching</h3>
<p>Authentication webhook session variables can be cached to improve the performance of a request with Hasura Enterprise Edition.</p>
</div>
</VersionedLink>
<h2 style={{ gridColumn: `1 / -1`, marginTop: `1.2rem`, marginBottom: `.3rem`, justifySelf: `start`, fontSize: `1.8rem` }}>Security</h2> <h2 style={{ gridColumn: `1 / -1`, marginTop: `1.2rem`, marginBottom: `.3rem`, justifySelf: `start`, fontSize: `1.8rem` }}>Security</h2>
<VersionedLink to="/security/api-limits/"> <VersionedLink to="/security/api-limits/">
<div className="card"> <div className="card">
@ -134,12 +140,6 @@ import Enterprise from '@site/static/icons/features/enterprise.svg';
<p>Configure multiple JWT secrets in Hasura Enterprise Edition to support multiple authentication providers.</p> <p>Configure multiple JWT secrets in Hasura Enterprise Edition to support multiple authentication providers.</p>
</div> </div>
</VersionedLink> </VersionedLink>
<VersionedLink to="/auth/authentication/webhook/#caching-webhook-session-variables">
<div className="card">
<h3>Caching Auth-Hook Session Variables</h3>
<p>Authentication webhook session variables can be cached to improve the performance of a request with Hasura Enterprise Edition.</p>
</div>
</VersionedLink>
<h2 style={{ gridColumn: `1 / -1`, marginTop: `1.2rem`, marginBottom: `.3rem`, justifySelf: `start`, fontSize: `1.8rem` }}>Event Triggers</h2> <h2 style={{ gridColumn: `1 / -1`, marginTop: `1.2rem`, marginBottom: `.3rem`, justifySelf: `start`, fontSize: `1.8rem` }}>Event Triggers</h2>
<VersionedLink to="/event-triggers/clean-up/auto-cleanup/"> <VersionedLink to="/event-triggers/clean-up/auto-cleanup/">
<div className="card"> <div className="card">