SixXS::Sunset 2017-06-06

Apache VirtualHost on a dual-stack domain
[ca] Carmen Sandiego on Wednesday, 03 June 2009 20:52:28
Hi, I have a domain (we'll call it domainname.net) that has both an A and AAAA record. I also have a www6.domainname.net which directly forwards to my AAAA record. So far this is working right. My question is: is there a way, with Apache 2.2.x, to prioritize where the client will be sent based on whether he is on IPv4 or IPv6 when he accesses either domainname.net or www.domainname.net? I have 2 VirtualHost blocks and the order I put then in my httpd.conf file changes Apache's behavior. Here's a snippet from my httpd.conf:
Listen 0.0.0.0:80 Listen [::]:80 NameVirtualHost *:80 <VirtualHost 0.0.0.0:80> ServerName www.domainname.net DocumentRoot "/usr/local/www/index" </VirtualHost> <VirtualHost [::]:80> ServerName www6.domainname.net DocumentRoot "/usr/local/www/index6" </VirtualHost>
Thanks!
Apache VirtualHost on a dual-stack domain
[ch] Jeroen Massar SixXS Staff on Thursday, 04 June 2009 00:18:51
The client decides what it contacts. IETF-wise they have to follow RFC3484, and then they first try to resolve the AAAA address of the hostname, and then the A record of the hostname (or if you have a newer glibc those resolv requests happen at the same time). getaddrinfo() then mixes it up according to RFC3484 (or the locally defined policy as per that RFC), which generally means AAAA first and then A. Server side you have no control over that. BTW, note that you can use "ServerAlias" to define multiple hostnames for one virtualhost. BTW2: the 'semi-standard' for "IPv6 enabled editions of a website" is ipv6.<domain> or www.ipv6.<domain>. When enabling the www.<domain> version with both an A and AAAA address some tend to then also create an www.ipv4.<domain> for the IPv4 only edition and www.ipv6.<domain> for the IPv6 only edition.
Apache VirtualHost on a dual-stack domain
[ca] Carmen Sandiego on Thursday, 04 June 2009 03:37:46
Thank you for your reply, very helpful! About the 'semi-standard', where did it originate and how applied is it?

Please note Posting is only allowed when you are logged in.

Static Sunset Edition of SixXS
©2001-2017 SixXS - IPv6 Deployment & Tunnel Broker