docs: add cache.varies docs for multi-tenant use case (#26197)

This commit is contained in:
Adam DeHaven 2024-03-11 10:35:33 -04:00 committed by GitHub
parent 06af1cd6d3
commit 5d3cbff6ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,12 @@ links:
`useRequestURL` is a helper function that returns an [URL object](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) working on both server-side and client-side. `useRequestURL` is a helper function that returns an [URL object](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) working on both server-side and client-side.
::important
When utilizing [Hybrid Rendering](/docs/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.unjs.io/guide/cache) (meaning `useRequestURL` will return `localhost` for the `host`).
You can define the [`cache.varies` option](https://nitro.unjs.io/guide/cache#options) to specify headers that will be considered when caching and serving the responses, such as `host` and `x-forwarded-host` for multi-tenant environments.
::
::code-group ::code-group
```vue [pages/about.vue] ```vue [pages/about.vue]