Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

doamin replacement irule

Sam10
Altostratus
Altostratus

I am trying to get logic for a domain replacement. When external users access *.api.domain.com F5 need to replace the domain with *.mydomain.com and send the request to the pool members.

 

.mydomain.com is not advertised externally,so i need F5 to do the domain replacement so the backend servers can process the traffic.

1 REPLY 1

Sam10
Altostratus
Altostratus

This is what i am trying to acheive. not getting my logic correct in irule.

 

User types in f5.api.domain.com , f5 need to replace that with f5.mydomain.com and send it to the back end server ,

and when backend server sends the response F5 need to again replace the request with f5.api.domain.com as client should not see the anywhere the internal domain in the header.

 

 

when HTTP_REQUEST {

 

       set external_hostname "*.api.domain.com"        

       set internal_hostname "*.mydomain.com"   

       HTTP::header replace "Host" $internal_hostname       

 

    }   

 

      when HTTP_RESPONSE {        

       if { [HTTP::header value "Location"] ends_with "$internal_hostname" }{

 

           set location [HTTP::header location]

 

           HTTP::header replace location $external_hostname

 

 

       }

    }