Forum Discussion

dcampbell791's avatar
dcampbell791
Icon for Nimbostratus rankNimbostratus
Dec 12, 2017

HTTP Host modification

Howdy all,

 

In the middle of a mid-sized data center migration for our clients to a new set of F5s. We want to give clients the ability to test migration before we move them permanently. The idea is to give them a test URL or testclientname.companyname.com but have an iRule trim the "test" off the http host and redirect to their new production url clientname.companyname.com. Is that something that is possible?

 

  • Hi Guy,

    Use this iRule:
    when HTTP_REQUEST {
    if { [HTTP::host] starts_with "test" } {
    set new_host [string range [HTTP::host] 4 end]
    HTTP::redirect "http://$new_host[HTTP::uri]
    }
    }