Lua Paywall (deprecated)
Custom server side paywall, with Lua
This solution became deprecated with Starter Kit 2.
So only available for setups stil on Starter Kit v1 or earlier.
How it works
Authentication of users is done in nginx with the help of Lua, this is not how it has to be done but we have found it a good and efficient way. Doing it there means we don't have to let all requests initialize PHP and Wordpress which would be a problem for performance.
So how is this done in practice? We have to make sure different cached content is delivered to users depending on their authorization status, we also have a check on a URL basis to make sure we don't run the authentication on content where it is not needed.
The authorization workflow is kickstarted in nginx configuration.
The Lua-code that sets this variable will validate cookie data or in some other way integrate with the authorization system to determine the status of the active user. When the status is determined it will set the value of the variable.
When the status is determined we add that variable as part of the cache key.
Usage in Naviga Web php code
When a request goes all the way to PHP we will be able to read a header value to get the authorization status. This means you can make decisions to show/hide or take any other actions depending on the status and it will only be applied to users with the same authorization status.
Last updated
Was this helpful?