Forum Discussion

minhal1984's avatar
minhal1984
Icon for Nimbostratus rankNimbostratus
Nov 22, 2023
Solved

Irule for diverting blocked gelocation users to a page

I have blocked certain users access to a URL through a gelocation in F5 but also want them to be diverted to a page just like we do for a maintanence page 

  • minhal1984 The iRule should look similar to the following. Please keep in mind that because of the user agreement you are not allowed to log the geolocation information so try not to use what exactly they matched. You can also change the information in the HTML code to display what you would like and you can also change the HTTP response code.

    when HTTP_REQUEST priority 500 {
    
        if { <geolocation_match_statement> } {
            HTTP::respond 200 content {
    
                <html>
                <head>
                <title>You Have Been Blocked</title>
                </head>
                <body>You Have Been Blocked</body>
                </html>
    
            }
        }
    
    }

2 Replies

  • minhal1984 The iRule should look similar to the following. Please keep in mind that because of the user agreement you are not allowed to log the geolocation information so try not to use what exactly they matched. You can also change the information in the HTML code to display what you would like and you can also change the HTTP response code.

    when HTTP_REQUEST priority 500 {
    
        if { <geolocation_match_statement> } {
            HTTP::respond 200 content {
    
                <html>
                <head>
                <title>You Have Been Blocked</title>
                </head>
                <body>You Have Been Blocked</body>
                </html>
    
            }
        }
    
    }