3.8 Customizing the block page

When a request is blocked for some reason then a block page is displayed that –by default– looks as follows (the actual blocking reason message may differ):

images/download/attachments/26167893/icap_blocked_ip.png

This page can be completely replaced using a custom block page.

Replacing the default block page

To replace the default block page create a HTML file with the custom content according to the following:

Operating system

Path

Default path

Owner

Permissions

Windows or Windows Server

<Installation folder>\data\block_page.html

C:\Program Files\Metadefender ICAP Server\data\block_page.html

Local Service

Read

Linux (RHEL / CentOS / Debian / Ubuntu)

<Data folder>block_page.html

/var/lib/mdicapsrv/block_page.html

mdicapsrv:mdicapsrv

r-- (400)

The default block page is not represented as a file in the file system. If the above file exists, then the default block page is overridden.

ICAP Server block messages

To display ICAP Server block messages in the custom page include the following token at the desired position in the page:

%%%icap_block_message%%%

This token will be replaced by the appropriate ICAP Server block message.

Example

The following example is the source code of a simple custom page that displays the ICAP Server messages only with no formatting at all:

<!doctype html>
<html>
<body>
%%%icap_block_message%%%
</body>
</html>

It renders a very simple page that looks like this:

images/download/attachments/26167893/image2017-9-7_14-52-36.png

Default block page source code

The default lock page's source code can be reused to create a customized one.

Default block page source code
<!doctype html>
<html>
<head>
<title>MetaDefender ICAP server - File blocked</title>
<style>
body {font-family:Arial, Sans-serif;color:#333;background-color:#ede9e3;margin:0;padding:0;}
#stripe {height:10px;background:#00a6dd;}
#error {width:678px;background:#fff;-moz-border-radius:7px;border-radius:7px;box-shadow:0 0 3px rgba(68,68,68,0.4);border:1px solid #a69f96;margin:50px auto 0;padding:50px;word-wrap:break-word;}
#error h2 {margin-top:0;color:#00a6dd;font-size:200%;}
#error p {margin:0 0 50px;}
#metascan {font-size:70%;border-top:1px solid #e0e0e0;color:#808083;padding-top:20px;margin-bottom:0!important;}
#metascan a {color:#808083;text-decoration:underline;}
</style>
</head>
<body>
<div id="stripe"></div>
<div id="error">
<h2>File blocked</h2>
<p>%%%icap_block_message%%%</p>
<p id="metascan">Your administrator is using OPSWAT&rsquo;s <a href="https://www.opswat.com/metadefender-core" target="_blank">MetaDefender Core technology</a> to scan downloads with multiple anti-malware engines. See additional ways MetaDefender Core can be used by trying the <a href="https://www.opswat.com/products/metadefender/client" target="_blank">MetaDefender Client</a> demo for scanning endpoint processes and files or the <a href="https://www.metadefender.com/" target="_blank">MetaDefender.com</a> file scanning service.</p>
</div>
</body>
</html>