Forum Discussion

Don_Whitlow_254's avatar
Don_Whitlow_254
Icon for Nimbostratus rankNimbostratus
Jun 04, 2013

GTM iRule to return alternate DNS result based on user-agent

Hi All,

 

This is more of a theoretical question at this point, but would it be possible to create an iRule on our GTM that would return a different DNS result based on the incoming client's user-agent setting? Specifically, if we identify it as a sanctioned crawler/bot, we'd like to return the IP address of our standby site, and for everything else, continue to return the DNS result that would point them to the primary site.

 

I know you can send traffic to a seperate pool on an LTM based on user-agent, but in our case, it would be better to send them to the alternate site, and not just an alternate pool. I've seen an example iRule that would blackhole a DNS request or send to a different site based on incoming source domain, but nothing specifically about doing it based on user-agent.

 

Like I said, at this point, it's more of a conceptual question at this point. Any feedback would be much appreciated.

 

Thanks in advance,

 

-Don

 

 

2 Replies

  • If that we're possible it'd solve a lot of other problems, but unfortunately the GTM DNS request doesn't see the user-agent header. That's not visible until the browser makes a layer 7 request to the LTM. It would, however, be trivial to redirect a request to a different site in an LTM iRule. You'd likely have to use an IP address or a different name that resolves to the remote site, but it's still doable.

     

     

    Do the sanctioned bots come from known IP spaces?

     

  • Hey Kevin,

     

    Thanks for the reply. That's what I was worried about. We could point the requests to another site at the LTM level, but we need to keep the site name intact. Think googlebot crawling a site. We want to keep the www.mydomain.com results. I know we could do it with a pool of servers in the same datacenter on the LTM, but that would require building out a couple more servers and keeping them in sync with the primary pool. Since we already do that with our standby site in the other datacenter, I was just looking for a way to get some use out of the otherwise under-used servers.

     

    Thanks again for confirming.

     

    -Don