If I have a website that is content based, and the web server accesses a CMS to determine what to display on the site for a particular page. This is not particularly fast and it requires computing power.
To solve this we use a CDN. So when we hit the cache we don't need as much computing power and we don’t need to access the CMS. If we do user authentication on the site this becomes an issue because of the following.
Authentication allows a user to sign up for an account log in to that account. This will allow them to access special content, save and vote for content, and see personalized content.
When you are logged in, most pages of the website will remain the same, except for a few differences:
- You will see “Welcome ” in the header.
- The menu will have 3 additional links. “My Account”, “My Content”, and “Logout”.
A typical login implementation might look like this:
- Ask for email and password.
- Post email and password over https to the application.
- The application sets an encrypted session cookie with the user id.
- Future requests to the application will include the cookie so that it can determine if someone is logged in and who it is.
- The header will be customized accordingly in the application.
The problem with this implementation is that in order for it to work you will need to access the web server every time for every page, therefore eliminating the CDN and the value that it provides.
This seems unnecessary because as stated earlier the website will remain mostly the same even when you are logged in.
Are there ways to take advantage of a CDN, yet still provide the login functionality that we’re looking for?