Forum Discussion

3 Replies

  • Hi,

    try this:

    when HTTP_REQUEST {
    
    if { [HTTP::uri] equals "/source" &&  [HTTP::host] equals "test.mycomany.com" }{
       HTTP::uri [string map {/source /destination} [HTTP::uri]]
       HTTP::header replace Host "othername.mycompany.com"
       pool poolname
    }
    }
    

    Regards

  • Hi,

    try this:

     when HTTP_REQUEST {
    
     set hostname [string tolower [HTTP::host]]
    
        if { [HTTP::uri] starts_with "/access/" &&  [HTTP::host] equals "fqdn2.com" }{
           HTTP::uri [string map {/access/ /content/} [HTTP::uri]]
           HTTP::header replace Host "fqdn1.com"
        } elseif {[HTTP::uri] equals "/access" &&  [HTTP::host] equals "fqdn1.com" } {
           HTTP::uri [string map {/access/ /content/} [HTTP::uri]]
        }
    
        }
    

    I don't know if it's necessary but i rewrite the location in response if necessary...

    when HTTP_RESPONSE {
    
    if { [HTTP::header is_redirect] && $hostname equals "fqdn1.com"} {
        HTTP::header replace Location [string map -nocase "fqdn1.com fqdn2.com" [HTTP::header value Location]]
    }
    }