snaem
snaem

Reputation: 85

AEM Dispatcher - cache rules

I am looking to get an understanding on a part of AEM dispatcher configuration. This will go under /cache /rules section

It looks like something below

/rules
        {
        # initial blanket deny
          /0000
          {
            /glob "*"
            /type "deny"
          }
          /0100
          {
           /glob "*.html"
           /type "deny"
          }
        }

Does rule 100 mean that the dispatcher is not caching any html pages?

Upvotes: 3

Views: 2231

Answers (3)

viki
viki

Reputation: 91

Here is the simple explanation:

/rules
       {
        # initial blanket deny
          /0000
          {
            /glob "*"
            /type "deny"
          }
          /0100
          {
           /glob "*.html"
           /type "deny"
          }
        }

/0000 -- rule will not allow anything to be cached.

if you want something to be cached just mention allow as per the below:

/rules

      /0100
      {
       /glob "*.html"
       /type "allow"
      }

Upvotes: 0

toniedzwiedz
toniedzwiedz

Reputation: 18553

Yes, the rule

/0100
{
  /glob "*.html"
  /type "deny"
}

means that no files with the .html extension will be cached. See the documenatation for more details.

I'm not sure what that would accomplish on a Publish instance. The only situation where it would seem apt would be if all HTML pages were rendered with user-specific data inline with the static parts (as in, user data rendered in JSP/HTL scripts responsible for displaying whole pages). Not caching HTML pages puts a significant strain on your Publisher farm. If the avoidance of caching dynamic data is the reason for this config, there are better ways to deal with serving user-specific data from AEM, each of which requires a change in your application and deployment architecture (AJAX calls, Server Side Includes, Sling Dynamic Inlcudes, Edge Side Includes, Templating Engines, to name a few).

As pointed out in the other answer, this can be a valid rule when the dispatcher is set up in front of an Author environment.

Upvotes: 3

Imran Saeed
Imran Saeed

Reputation: 3444

Adding another answer and explanation for the rule from your question:

/0100
{
    /glob "*.html"
    /type "deny"
}

Yes (as pointed in other answer), it means .html won't be cached. This may sound weird but it's not an uncommon practice when a dispatcher is configured in front of an AEM author server as described in this documentation.

The html pages on AEM author are almost session specific so caching them will cause a lot of problems.

In case you are wondering, the dispatcher in front of an AEM author is really effective if you are caching AEM libs and static/non-user specific content.

Upvotes: 2

Related Questions