Caching Redirect Responses With Dispatcher? | Community
Skip to main content
timlwhite
Level 2
July 21, 2017
Solved

Caching Redirect Responses With Dispatcher?

  • July 21, 2017
  • 11 replies
  • 11505 views

Hello -

We have lots of pages in our AEM Publisher that end up returning a 302 or 301 redirect response.

Is there any way to configure Dispatcher to cache those, so they don't make their way to the publisher each time?

I tried turning on the "header caching" for the "Location" header, but that didn't seem to help.

I see articles on the Internet about setting up a Varnish cache to do this, but that's not feasible in our environment, hence why I am hoping there is a way to do it with Dispatcher.

Thanks!

Tim

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by alberndt

Before the dispatcher supported vanity urls, it was a common approach to generate a parts of the apache config dynamically on the publisher.

Therefore on the Apache each virtual-host defintion contained an optional include for a dynamically generated config-snippet. On the publisher was a servlet - which generated these config snippets (typically a lot of mod_rewrite rules for vanity-urls and redirects). A cron-job on Apache (= dispatcher) server called the servlet every 10 minutes, placed the generated configuration into the right place and made the Apache to reload the configuration (soft restart = no downtime). Nicer solutions generated a zip-file cointaining all configuration-snippets in a single archive. Also the cron job should let the Apache check the syntax of the configuration first. Otherwise there is a risk to halt the Apache.

This allowed very powerful vanity-urls and redirects. It could also be used for filter-rules, etc.

11 replies

cqsapientu69896
Level 4
January 14, 2019

thanks gauravb10066713, will try and post results/finding here in some time