# How to cache pages that are mostly static but has a "logged in" bar?

**URL:** <https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177>\
**Category:** NGINX\
**Created:** [April 25, 2011, 2:13am UTC](https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177 "2011-04-25T02:13:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 25, 2011, 2:13am UTC](https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177/1 "2011-04-25T02:13:07Z")

</div>

I have pages that are generated dynamically but don’t change all that  
often. Would like to use Nginx to cache those pages.

However every page has a “log in” bar at the top, similar to this forum.  
A logged-in user would see his name and a “log out” link. A user who  
isn’t logged in would see links to “log in” or to “register”.

How do I cache a page like this where there is a small element that  
needs to be personalized? Normally this is a job for ESI, but Nginx  
doesn’t support ESI. Any suggestions?

Thanks.

Posted at Nginx Forum:

> **[How to cache pages that are mostly static but has a "logged in" bar?](https://forum.nginx.org/read.php?2,193466,193466#msg-193466)**
>
> I have pages that are generated dynamically but don't change all that often. Would like to use Nginx to cache those pages. However every page has a "log in" bar at the top, similar to this forum. A logged-in user would see his name and a...

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [April 25, 2011, 2:16am UTC](https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177/2 "2011-04-25T02:16:13Z")

</div>

Forgot to add, I’m planning to use memc-nginx-module for the caching, if  
that makes any difference.

Posted at Nginx Forum:

> **[Re: How to cache pages that are mostly static but has a "logged in" bar?](https://forum.nginx.org/read.php?2,193466,193467#msg-193467)**
>
> I have pages that are generated dynamically but don't change all that often. Would like to use Nginx to cache those pages. However every page has a "log in" bar at the top, similar to this forum. A logged-in user would see his name and a...

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [April 25, 2011, 4:03am UTC](https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177/3 "2011-04-25T04:03:29Z")

</div>

separate the part. use ajax in my opinion

在 2011-4-25 上午8:15，“Andy” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)编写：

Forgot to add, I’m planning to use memc-nginx-module for the caching, if  
that makes any difference.

Posted at Nginx Forum:

> **[Re: How to cache pages that are mostly static but has a "logged in" bar?](https://forum.nginx.org/read.php?2,193466,193467#msg-193467)**
>
> I have pages that are generated dynamically but don't change all that often. Would like to use Nginx to cache those pages. However every page has a "log in" bar at the top, similar to this forum. A logged-in user would see his name and a...

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [April 25, 2011, 10:58pm UTC](https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177/4 "2011-04-25T22:58:54Z")

</div>

Splitice Wrote:

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [April 25, 2011, 4:08am UTC](https://www.ruby-forum.com/t/how-to-cache-pages-that-are-mostly-static-but-has-a-logged-in-bar/206177/5 "2011-04-25T04:08:24Z")

</div>

Ssi would be the only way

Sent from my iPod
