Posted by: Marco Fabbri | October 22, 2011

Caching Madisons home page with ESI using a rewrite rule to allow SEO

There is a clean way to keep using SEO URLs (static version) and allow caching at IHS level.

The infocenter says:

“Static URLs can only use WebSphere dynamic caching at the Application Server.”

Then, in theory, you can’t cache at IHS level a static URL like

http://localhost/webapp/wcs/stores/servlet/TopCategories1_10001_10001

Buy if you “rewrite” this URL to his dynamic version

http://localhost/webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=10001&catalogId=10001

BEFORE it’s processed by the plugin, you can still cache it with ESI.

This is what I did: I added this simple rewrite rule to the Commerce virtual host on IHS

RewriteRule ^/webapp/wcs/stores/servlet/TopCategories1_(.+)_(.+)$ /webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=$1&catalogId=$2 [PT]

and voilá. This way I’m still using the SEO URLs but I’m caching it on ESI.

Be carefully: the PT (Pass Through) option in the rule is VERY important.

According to the Websphere plugin documentation:

“The PT flag is required, as this is what lets the WebSphere plug-in observe the results of the mod_rewrite processing.”

this option allows you to “cheat” the plugin and cache the home page contents on the edge.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.