N
Nuxt3mo ago
Eric

Middleware for OUTGOIN requests ?

from what I understand, middlewares run on every route change. But I would like a piece of code to run every time a request is made to the file storage that live on different domains. I would like to intercept to request made by img tags to set the authorization header... Is there a way to create that ?
3 Replies
manniL
manniL3mo ago
Try a nitro API endpoint that calls the endpoint
Eric
Eric3mo ago
thanks for you response ! but I don't see what you mean 😅
manniL
manniL3mo ago
so, instead of calling the domain directly, set up a nitro api endpoint which you can call That endpoint then calls the domain with the right headers for example if you think about $fetch requests though, use an interceptor