Forum Discussion

Rahim_Abdul_re1's avatar
Rahim_Abdul_re1
Icon for Nimbostratus rankNimbostratus
Jun 08, 2017

URL Rewrite without changing the URL

We implemented the URL Rewrite Irule. When we access the https://2.2.2.2/T001/mds change the URL on internet explorer address bar to http://1.1.1.1/insight. I don't want to change URL. User will see https://2.2.2.2/T001/mds instead of http://1.1.1.1/insight.

 

when HTTP_REQUEST { if { [HTTP::uri] contains "/T001/mds" } { SSL::disable serverside HTTP::header replace "Host" "1.1.1.1" HTTP::path "/insight"

 

pool CMD

 

} else { pool FCUB-UAT-BCRS } }

 

4 Replies

  • Try below irule & update if facing issue.

            when HTTP_REQUEST {
        set host [string tolower [HTTP::host]]
                STREAM::disable
            }
        when HTTP_RESPONSE {
             Check if response type is text and host isn't null
            if {[HTTP::header value Content-Type] contains "text" and $host ne ""}{
            STREAM::expression "@https://2.2.2.2/T001/mds@http://1.1.1.1/insight@" }
            STREAM::enable
        }
    
  • Hi,

     

    That is for sure not result of posted iRule. It has to be result of backend server response.

     

    Try to trace session via tcpdump or better Wireshark (on client for example) and see what is BIG-IP (or rather backend server) response to your GET request.

     

    Only reason to see changed URL in browser is if backend serwer is sending redirect with Location header containing http://1.1.1.1/insight or there are some hard coded references to http://1.1.1.1/insight in returned page (my guess, not sure if this can cause such situation as well).

     

    Piotr

     

  • Hi,

    Try this solution:

    change your iRule to:

    when HTTP_REQUEST {
    if { [HTTP::uri] contains "/T001/mds" } {
        SSL::disable serverside 
        pool CMD 
    } 
    else {
        pool FCUB-UAT-BCRS 
    } 
    

    }

    Create Rewrite profile:

    • Navigate to “Local Traffic ›› Profiles : Services : Rewrite”
    • Click “Create New Profile”
    • Type name for your profile and select "rewrite-uri-translation" for Parent profile.
    • Navigate to “URI Rules”
    • Click on “Add” and for “Client URI” type “/T001/mds” and for “Server URI” type “http://1.1.1.1/insight/
    • "Rule Type" should be "Both"
    • Click “OK”
    • Assign the profile to the VIP