The maintenance page could have a html structure similar to the web template, or it could just be an image with a friendly message. For example, maintenance.html could be defined as follows:
<!doctype html>
<html>
<head>
<meta
charset="utf-8">
<meta http-equiv="X-UA-Compatible"
content="IE=edge">
</head>
<body>
<div>
<img
src="/Static/ClientPages/img/Maintenance.jpg">
</div>
</body>
</html>
Once page is uploaded to the server, some code must be inserted inside the OHS virtual host element in the configuration file (mod_wl_ohs.conf). For instance, the following code redirect all the OHS requests to the plain maintenance page.
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !/Static/ClientPages/*
RewriteRule ^.*$ /Static/ClientPages/maintenance.html
[R=503,L]
Header Set Cache-Control "max-age=0, no-store"After that, OHS instance needs to be restarted using the opmnctl command.
Also, it is interesting to set error pages to different HTTP status codes. The following lines force the display of error and maintenance pages depending on the type of errror: Internal server error (500) or Service unavailable (503).
ErrorDocument 500 /Static/ClientPages/error.html
ErrorDocument 503 /Static/ClientPages/maintenance.html
Other options are:
- IP exceptions: It is possible to set IP exceptions to the redirect operation, that could be developers' addresses.
- Checking first if the maintenance page exists.
- External switch to enable and disable maintenance: OHS redirects to maintenance pages if a file exists.
These options are well explained in this post.
References:
Redirect Site to Maintenance Page using Apache and HTAccess
Setting a WebCenter Maintenance Page
HTTP status codes
Apache mod_rewrite
No comments:
Post a Comment