2

On my website I have in the header a button called either "Login" or the name of the user if he is logged in with a small avatar. I don't use any cache, so the text for the header is evaluated at the server side.

Most of my pages are static if I exclude the dynamic header (login status). I would like to use a CDN to cache those static pages, but I don't know what to do about the "login/username" section.

Does a CDN cache technique exists that can make use of cookies? So the page could be cached and the header link is just determined by the cookie?

I also was thinking about using ajax to show the login/user name, but I feel this gives the feeling of a lagging website. I noticed that mailtrap.io is using a technique like this and it always confuses me. Alternativly, I was thinking about just naming the menu item "Dashboard" without giving the user an indication if he is logged in or not.

Are there any other/better options=

1 Answer 1

1

A CDN is best used for static content such as images, css files, and javascript files placing these files as close to the end user as possible with the html for the page (including the user / login button) coming from the server. This will still provide the benefits of a CDN for your static files without causing issues for caching of what amounts to a user generated block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.