Expand my Community achievements bar.

SOLVED

How to restrict apache dispatcher to allow published pages only?

Avatar

Level 6

We are migrating from AEM 6.0 to AEM 6.3. As a phased migration, we are placing RewriteRule condition at apache that

- If URI matches to migrated page, continue to 6.3 publisher.

- If URI is not in list of migrated pages, redirect to 6.0 domain.

Currently the list of migrated pages in RewriteCondition is manually edited. When authoring team migrate a page, a developer adds a new Rule in apache.

Requirement: The apache RewriteCondition should redirect to publisher for all published pages automatically. If a page is not available at publisher, it should automatically redirect to 6.0 domain.

Approaches: Currently a developer edits the RewriteCondition when author publish a new page. Proposal is use RewriteMap:

- A sling servlet will prepare the RewriteMap flat text file with list of published pages

- A cron job at apache server hits the servlet, pulls the list of published pages and places map file in correct path

- A single RewriteMap condition looks up the map file, if entry is found allows to publisher; else redirects to 6.0 domain.

Is this proposed solution correct? Is there any other recommended way for our problem statement?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Of you course you can write servlet and feed its output into a rewritemap (and do a graceful restart afterwards). I do this for defining virtual hosts on my current project. Works very well.

Jörg

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Of you course you can write servlet and feed its output into a rewritemap (and do a graceful restart afterwards). I do this for defining virtual hosts on my current project. Works very well.

Jörg

Avatar

Level 6

Sorry for late response. I did get the rewritemap approach working. I was stumbling bit with syntax and finally got it working with this: