Forum Discussion

Carl_F_14478's avatar
Carl_F_14478
Icon for Nimbostratus rankNimbostratus
Apr 29, 2014

rewrite response DNS name to an IP address

I have a test VMware workspace server that is redirecting IP to a DNS name which is not valid on the internet. I would like to rewrite the response packets to the VIP IP address. For example, I go to https://1.1.1.1 and the server replies/redirects to https://workspace.mydomain.com/xxx/xxx but workspace.mydomian.com is not a valid name on the Internet so the session fails. I want to rewrite the response so the IP address stays in the URL header and removes the DNS host name but keeps the URI information in place.

 

Can someone tell me how this could be done?

 

1 Reply

  • Maybe something like this?

    when HTTP_RESPONSE {
        if { [HTTP::is_redirect] } {
            set location [string tolower [HTTP::header values Location]]
    
            if { $location contains "workspace.mydomain.com" } { 
                HTTP::header replace Location [string map {"workspace.mydomain.com" "2.2.2.2"} $location]
            }
        }
    }
    

    /Patrik