I’m looking at building an age-gate into a new project, but not sure on the best approach for this.
I was hoping Edge Handlers would be the solution but they’re in beta and it sounds like the beta access is currently closed. Also, the docs don’t indicate whether cookies are accessible when using an Edge Handler.
So, I am now thinking that proxying all requests via a Netlify function would work. The function would have access to check for an age-gate cookie. If the cookie is set the function can send the request to the originally requested URL. Otherwise, it would redirect to the age-gate page itself.
However, if this would be called for all incoming requests it would quickly ramp up the function usage.
Any recommendations for optimising the function usage?