Varnish cache: how to detect IPv6

The following VCL code detects if the client is connected using IPv6:

acl isipv6{                     
        "::"/0;
}                      
sub vcl_recv {          
    # [... whatever rules you like ...]
    if(server.ip ~ isipv6){
        # [... whatever rules you like ...]
    }
    # [... whatever rules you like ...]
}

You may want to use that for example for a "you're ipv6 enabled" banner.

© GeekLabInfo Varnish cache: how to detect IPv6 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
Categories: IT

Leave a Reply