# CNAME Flattening

**URL:** <https://community.f5.com/t/cname-flattening/75496>\
**Category:** Technical Forums\
**Created:** [December 7, 2024, 5:50pm UTC](https://community.f5.com/t/cname-flattening/75496 "2024-12-07T17:50:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![REddy](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@REddy](https://community.f5.com/u/REddy)\
**Post date:** [December 7, 2024, 5:50pm UTC](https://community.f5.com/t/cname-flattening/75496/1 "2024-12-07T17:50:18Z")

</div>

Hi,

F5 GTM’s are our domain (let us say [example.com](http://example.com)) authorized DNS servers. Our website is accessible on &nbsp;[example.com](http://example.com) and [www.example.com](http://www.example.com). We are migrating to the cloud and the DNS queries will still hit the GTM’s and we need to redirect to the Cloud front door (CNAME Record).

The existing set up is with the 2 WIP’s([www.example.com](http://www.example.com) and [example.com](http://example.com)) on the GTM points to the pool. To migrate, we have created the CNAME records in the zonerunner , the challenge is we cant create the CNAME record for the root zone ([example.com](http://example.com)) as there will be NS records etc. We have created CNAME based WIDEIP for [example.com](http://example.com) with the CNAM based pool (Cloud front door).&nbsp; When i access [example.com](http://example.com) , we get the error on the browser saying “DNS prod finished nxdomain error”.&nbsp; When i dig specifically with CNAME on google DNS, Dig interface I can see the CNAME record.

Tried with few irules, however we are getting errors.

#########################################################

when DNS\_REQUEST {  
set queried\_name [DNS::question name]  
set Cloud\_FD “abc.xyz”  
&nbsp; &nbsp; if { [string tolower $queried\_domain] eq “[example.com](http://example.com)” } {  
&nbsp; &nbsp; &nbsp; &nbsp; set cname\_record “${queried\_name}. 300 IN CNAME ${Cloud\_FD}.”  
&nbsp; &nbsp; &nbsp; &nbsp; set new\_rr [DNS:rr ${cname\_record}]  
&nbsp; &nbsp; &nbsp; &nbsp; DNS::answer clear  
&nbsp; &nbsp; &nbsp; &nbsp; DNS::answer insert $new\_rr  
&nbsp; &nbsp; &nbsp; &nbsp; DNS::return  
&nbsp; &nbsp; }  
}

##########################################################

---

<div class="post-metadata">

**Author:** ![Mohamed\_Salah\_1](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/mohamed_salah_1/32/18777_2.png) [@Mohamed\_Salah\_1](https://community.f5.com/u/Mohamed_Salah_1)\
**Post date:** [December 11, 2024, 10:45pm UTC](https://community.f5.com/t/cname-flattening/75496/2 "2024-12-11T22:45:11Z")

</div>

If you haven’t mentioned in ZoneRunner that those records are configured as CNAMEs instead of A records, you will not receive a result when querying for these records. This is because no delegation is taking place. It will only work when you query for the CNAME as you have mentioned, as the response will be returned from the WIDE-IP.

If I understand the setup correctly, you have ZoneRunner acting as the authoritative DNS, and there are some records that need to be delegated to the cloud.

For example, if [www.example.com](http://www.example.com) have an A record in ZoneRunner, you will need to create a CNAME instead, such as [www.host.example.com](http://www.host.example.com). This subzone should then be linked with the glue records, which are the NS records for the cloud.

After making these changes, you can test the again.
