Expand my Community achievements bar.

SOLVED

Short hand urls not getting flushed or invalidated from server

Avatar

Level 2

I am using AEM 6.3.1.0. To achieve URL shortening I used Apache Sling resource resolver factory and it works fine. Now at apache, the cache is persisted with shortened paths as /en/home.html, /en/home/page1.html etc.

This disturbs flush agents as when /content/myapp/en/home is published, corresponding path is not found in apache and no flushing happens. This makes /en/home.html obsolete.

One solution i got to fix this issue is apache rewrite rules in httpd.conf file. If i add the rewrite rules so i dont need to add the rewrite rules in Apache Sling resource resolver factory am i right? Or do we have any other way to fix this issue other than apache rewrite rules.

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Couple of options:

  • Write a custom flush agent to do what 'ACS Dispatcher Flush Rules' does. In fact, you could reuse the source code per your requirements. The approach is to manipulate the flush path to achieve what you want to do
  • There is a flag in replication/flush agents as 'Alias Update'. When it is turned on, it flushes the vanity urls configured in page properties as sling:vanity. I'm not sure if it would work with resource resolver but you can try or borrow this feature.
  • Custom rewrite rules in apache that you already tried/tested.

       

View solution in original post

3 Replies

Avatar

Level 10

Use ACS Dispatcher Flush Rules to flush /content/myapp/en*=/en*   or /content/myapp/.*=/.*

Create rules per your requirements

Avatar

Level 2

Hi Gaurav,

We are not using ACS common package in our project is there any thing else that we can do to clear the cache for short urls.

Avatar

Correct answer by
Level 10

Couple of options:

  • Write a custom flush agent to do what 'ACS Dispatcher Flush Rules' does. In fact, you could reuse the source code per your requirements. The approach is to manipulate the flush path to achieve what you want to do
  • There is a flag in replication/flush agents as 'Alias Update'. When it is turned on, it flushes the vanity urls configured in page properties as sling:vanity. I'm not sure if it would work with resource resolver but you can try or borrow this feature.
  • Custom rewrite rules in apache that you already tried/tested.