From 1b3a16f93a2bb11e2eee19c2ea0e6e2a0aa29715 Mon Sep 17 00:00:00 2001 From: Adam DeHaven Date: Mon, 11 Mar 2024 10:19:49 -0400 Subject: [PATCH] docs(nuxt): add cache.varies docs for multi-tenant use case Cached responses return localhost for the host since headers are discared. Document the cache.varies option for multi-tenant environments. --- docs/3.api/2.composables/use-request-url.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/3.api/2.composables/use-request-url.md b/docs/3.api/2.composables/use-request-url.md index a2d4a8e3c81d..1ed09bb66b52 100644 --- a/docs/3.api/2.composables/use-request-url.md +++ b/docs/3.api/2.composables/use-request-url.md @@ -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. +::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 ```vue [pages/about.vue]