Jonas Reif
Jonas Reif
NNuxt
Created by Jonas Reif on 7/31/2024 in #❓・help
NuxtImage: How can I generate static images using storyblok (or any other external image provider)
We use static generation for our nuxt3 app. Currently the images itself which we host at storyblok and (some on cloudlfare r2) are not being generated. Is there any way to generate those images?
3 replies
NNuxt
Created by Jonas Reif on 3/14/2024 in #❓・help
Preventing ISR Caching for Authenticated Users on Vercel with Nuxt
We're using Nuxt's hybrid rendering for our app, specifying different ISR settings for public pages and our login area to ensure up-to-date data. Here's our setup:
'/**': { isr: 3600 }, //
'/de/app/*': { isr: false }
'/**': { isr: 3600 }, //
'/de/app/*': { isr: false }
To redirect authenticated users from public pages to the login area, we use a global middleware:
export default defineNuxtRouteMiddleware(async (to, from) => {
const authStore = useAuthStore() // authstore is a pinia store which saves auth data into cookies

if (authStore.userIsAuthenticated) {
return navigateTo(useNuxtApp().$localePath('/app))
}
})
export default defineNuxtRouteMiddleware(async (to, from) => {
const authStore = useAuthStore() // authstore is a pinia store which saves auth data into cookies

if (authStore.userIsAuthenticated) {
return navigateTo(useNuxtApp().$localePath('/app))
}
})
` When an authenticated user accesses a public page exactly when the 3600-second cache expires, they are correctly redirected as intended. However, Vercel caches this redirect action, causing even unauthenticated users to be redirected. Question How can we prevent or bypass ISR caching for authenticated users, or avoid caching these redirects on Vercel? Is there a specific configuration or approach that could help in this scenario? Is there also a way to bypass all ISR caching in some scenarios globally (e.g. when user is authenticated) Thanks for your help! 🙂
2 replies