Configure NTOP To Proxy Through Apache

ntop_logo The NTOP faq contains snippets of code about how to proxy the NTOP http server through Apache for improved security. However, with new updates to the program the image iFrames are incorrectly posting the following javascript:

<script type="test/javascript">
/ntop//ntop/<![CDATA[
...
/ntop//ntop/]]>
</script>

The correct output should be:

<script type="test/javascript">
//<![CDATA[
...
//]]>
</script>

Using the mod_proxy_html module we can modify the pages using the following:

ProxyHTMLURLMap  /ntop//ntop/      //

The full NTOP proxy configuration is as follows:

<IfModule mod_proxy_http.c>
        ProxyHTMLLogVerbose On
        LogLevel warn
        ProxyHTMLExtended On

        ProxyRequests Off
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass /ntop/  http://localhost:3000/
        ProxyPassReverse /ntop/  http://localhost:3000/

        <Location /ntop/>
                SetOutputFilter  proxy-html
                ProxyHTMLURLMap  /      /ntop/
                ProxyHTMLURLMap  /ntop//ntop/      //
                ProxyHTMLURLMap /ntop/plugins/ntop/ /ntop/plugins/
                RequestHeader    unset  Accept-Encoding
        </Location>
</IfModule>

Leave a Reply

Your email address will not be published. Required fields are marked *