Simple Lambda Cookie Question
tldr: Do cookies work on initial page load on AWS Lambda?
Hey folks - building something for aws-lambda and everything is up and running except the
useCookie
method on initial load: I'm reading it in some routeMiddleware and looks something like this:
So, simple test to see if they are on any route other than pin-code
and if they are I read the cookie. If the cookie isnt there or it doesn't equal to my super secure password I redirect them to the pin-code page.
This works totally fine locally. On Lambda it works on any subsequent page as you click around and router is used. However, initial page load doesn't seem to be able to read the cookie. What am I missing?2 Replies
@Gary try to check when you're middleware is executed : https://nuxt.com/docs/guide/directory-structure/middleware#when-middleware-runs
Nuxt
middleware/ · Nuxt Directory Structure
Nuxt provides middleware to run code before navigating to a particular route.
set it as global to