Dispatcher – AEM

Perform no regression tests during the maintenance

Goal

It depends on the project, or on the company, but we don’t always have automated tests that run after a deployment. So, we have testers that after the deployment on production perform manually some no regression tests. It also happens that there are big releases that need your system to be temporarily suspended. In this case, you put your website in maintenance. In short, it could be useful to check the result of your deployment before turning off the maintenance. I’ll show you what we used to do in these cases.

Procedure

Go in your vhost file, which should be located in the folder conf.d/available_vhost if you are using the latest folders structure. Inside the rewrite module (“<IfModule mod_rewrite.c>”) you should have something like this if you are forcing the user to go to the maintenance page via Apache:

        RewriteCond %{REQUEST_URI} !^/etc
        RewriteCond %{REQUEST_URI} !^/libs
        RewriteCond %{REQUEST_URI} !^/apps
        RewriteCond %{REQUEST_URI} !^/content
        RewriteRule ^/(.*)$ /path-to-maitenance-page.html [R=302,L]
        

Where (.*)$ could be the entire website or for instance just the private area. It depends on your website and the kind of activities that are going on. Add this other condition: RewriteCond %{REMOTE_ADDR} !^XXX\.XXX\.XXX\.XX where the XXX will be replaced by your VPN IP.

        RewriteCond %{REMOTE_ADDR} !^XXX\.XXX\.XXX\.XX 
        RewriteCond %{REQUEST_URI} !^/etc
        RewriteCond %{REQUEST_URI} !^/libs
        RewriteCond %{REQUEST_URI} !^/apps
        RewriteCond %{REQUEST_URI} !^/content
        RewriteRule ^/(.*)$ /path-to-maitenance-page.html [R=302,L]
        

In this way, if you are connected to the VPN you won’t be redirected to the maintenance!

And use it in your HTL code, as shown at line 1. Pass as parameter the node name where your data is stored, in this case “multifield”.

That’s all! Hope it could be useful.

Cheers! 🍻

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: