Reverse proxy using DNS resolution?

I’m looking for options to create Virt (+iRule) on F5 that can process incoming connections with following logic:

  1. Resolve destination host of the request using specified DNS server
  2. Proxy request to result server (if DNS query were successful)

Nginx configuration of that logic (works currently) looks like this:

server {
listen 80;
server_name _;
location / {
resolver ;
proxy_pass http://$host:$request_uri;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Server;
}
}

This configuration, coupled with wildcard domain record, gives nice a quick way to create Public Access Endpoint to some dynamic cloud boxes…

blabla1.publicdomain.com blabla2.publicdomain.com

*.publicdomain.com - public DNS record pointing to the VIP

blabla1/blabla2 - gets resolved on private DNS (which gets updated during VM creation)

The example iRule on the wiki page for RESOLV::lookup should be pretty close to what you need:

If this is for HTTP traffic you’d probably want to switch the CLIENT_ACCEPTED event to HTTP_REQUEST and resolve on the HTTP::host value.