Apache HTTPD

From ARIN IPv6 Wiki

Revision as of 13:58, 27 November 2011 by Avij (Talk | contribs)
Jump to: navigation, search

Detecting IPv6 Clients

You can configure Apache HTTPD to set an environment variable if the client is using IPv6:

# httpd.conf
# Set an environment variable if access is IPv6
SetEnvIfNoCase REMOTE_ADDR "^[0-9a-f:]+$" IPV6_USER=1

If Server Side Includes are enabled, you can modify page content based on whether the client is using IPv4 or IPv6:

Hello client from
<!--#echo var="REMOTE_ADDR" -->
<br>
<!--#if expr="$IPV6_USER" -->
<b>You are using IPv6.  Good!</b>
<!--#else -->
<b>You are not using IPv6.</b>
<!--#endif -->
Personal tools