Palo Alto Networks Knowledgebase: How to Create Different Captive Portal Page Based on Subnet

How to Create Different Captive Portal Page Based on Subnet

2696
Created On 02/08/19 00:08 AM - Last Updated 02/08/19 00:08 AM
Resolution

The following is an example script where one page is displayed for the 10.16.0.0/24 network and another page for the 10.16.3.0/24 network.

<html>
<body>
<script language="Javascript">
        var ipaddr='<user/>';
        document.write('My IP Address is ' + ipaddr);
        //split the string into it's constituent octets
        var ipparts = ipaddr.split('.');
        //ipparts will now contain the octets of the ip address
        //ie 10.0.0.1 will be split up as ipparts[0] = '10', ipparts[1]='0', ipparts[2]='0' and finally ipparts[3]='1'
        //in this example, if the 3rd octet is 0, we display one header, otherwise the other header
        if (ipparts[2]=='0') {
                document.write('<h1 ALIGN=CENTER>Captive Portal from 10.16.0.0 networks</h1>');
                document.write('<h2 ALIGN=LEFT>In accordance with company security policy, you have to authenticate before accessing the network.</h2>');
        } else {
                document.write('<h1 ALIGN=CENTER>Other Captive Portal 10.16.3.0</h1>');
                document.write('<h2 ALIGN=LEFT>In accordance with company security policy, you have to authenticate before accessing the network.</h2>');
        }
</script>

<pan_form/>
</body>
</html>

owner: wtam



Attachments
Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000ClK3CAK&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

Choose Language