How to restrict apache dispatcher to allow published pages only? | Community
Skip to main content
sarav_prakash
New Participant
Sep 18, 2018 3:42 AM UTC
Solved

How to restrict apache dispatcher to allow published pages only?

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
joerghoh
joerghohAccepted solution
Employee
Sep 25, 2018 11:28 AM UTC

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

3 replies

sarav_prakash
New Participant
Sep 25, 2018 12:31 PM UTC

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

Translate
joerghoh
joerghohAccepted solution
Employee
Sep 25, 2018 11:28 AM UTC

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

Translate
kautuk_sahni
Employee
Sep 25, 2018 11:22 AM UTC

Joerg Hoh any help here ?

Translate
Kautuk Sahni