For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

35 Replies

  • Hi Nitaas, Thanks for your input. Following is the irule which irule editor is accepting,

     

    elseif {[HTTP::host] eq "xyz.com" and [HTTP::uri] eq "/adblogtest" } {

     

    HTTP::header replace location "http://www.google.com."

     

    HTTP::uri "/"

     

    HTTP::collect

     

    NAME::lookup www.google.com}

     

    }

     

    It is not acception 'rule rewrite', it says command not valid in current context, pls suggest.
  • hi puneet,

     

     

    the rule rewrite1 line is the rule name. i think u don't need to put it in irule editor.

     

     

    in addition, why do u use HTTP::header replace location instead of host??

     

     

    hth,

     

    nitass
  • Hello All,

     

    I have a same kind of requirement and for that I am working since long time had tried many iRules but not able to success for the same, but when I tried the iRule given by Nitass I am partially succeeded to achieve my requirement

     

    Requirement: My company URL shop.company.com need to redirect to the one external public URL suppose http://www.cisco.com/web/partners/index.html but user will only see shop.company.com. When I tried the Nitass iRule I am able to reach www.cisco.com but not getting through URI part. Could you please help me on the same.

     

    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      Also currently shop.company.com is not resolving to any public or private IP address I have done host entry on my machine.
  • Hello All,

     

    I have a same kind of requirement and for that I am working since long time had tried many iRules but not able to success for the same, but when I tried the iRule given by Nitass I am partially succeeded to achieve my requirement

     

    Requirement: My company URL shop.company.com need to redirect to the one external public URL suppose http://www.cisco.com/web/partners/index.html but user will only see shop.company.com. When I tried the Nitass iRule I am able to reach www.cisco.com but not getting through URI part. Could you please help me on the same.

     

    • Ashish_Ram_Taka's avatar
      Ashish_Ram_Taka
      Icon for Nimbostratus rankNimbostratus
      Also currently shop.company.com is not resolving to any public or private IP address I have done host entry on my machine.
  • Requirement: My company URL shop.company.com need to redirect to the one external public URL suppose http://www.cisco.com/web/partners/index.html but user will only see shop.company.com. When I tried the Nitass iRule I am able to reach but not getting through URI part.

     

    you have to manipulate path of all the objects inside the page.

     

    for example, in the cisco index.html may have several objects such as image, css. if they are using absolute path, no change is needed. anyway, if they are using relative path, you have to add /web/partners/ (because it is related to /web/partners/ not /).

     

    hope this helps.

     

    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      Hello Nitass, I have tried that option but not working, please find the below iRule I am also attaching the iRules which I have tried. when HTTP_REQUEST { HTTP::collect NAME::lookup www.cisco.com/ } when NAME_RESOLVED { if { [HTTP::uri] eq "/try" } { HTTP::header replace Host "www.cisco.com/web/partners/" HTTP::uri "/" node [NAME::response] 80 } else { pool foo1 } snat automap HTTP::release }
    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      i Rule 2 when RULE_INIT { set doSSL 0 } when HTTP_REQUEST { HTTP::header remove "Accept-Encoding" switch [string tolower [HTTP::host]] { "shop.company.com" { if {([HTTP::path] eq "/")} { HTTP::header replace Host "company.force.com" HTTP::uri "/shop/" } pool company.force.com } default { } } } when SERVER_CONNECTED { log local0. "pool [LB::server pool]" if {[string tolower [LB::server pool]] contains "company.force.com" } { SSL::enable serverside } else { SSL::disable serverside log local0. "ssl disabled" } }
    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      iRule 3 when HTTP_REQUEST { set host_header_value "http://company.force.com/" if {([HTTP::host] contains "shop.company.com")} { HTTP::header replace Host $host_header_value HTTP::uri "/shop/" log local0. "[IP::client_addr]:[TCP::client_port]: Replaced Host header with $host_header_value." pool company.force.com } else { } } when HTTP_RESPONSE { if {([HTTP::header exists "Location"]) && ([HTTP::header "Location"] contains "company.force.com")} { HTTP::header replace "Location" "http://shop.company.com" log local0. "Replaced Location header in response." } }
  • Requirement: My company URL shop.company.com need to redirect to the one external public URL suppose http://www.cisco.com/web/partners/index.html but user will only see shop.company.com. When I tried the Nitass iRule I am able to reach but not getting through URI part.

     

    you have to manipulate path of all the objects inside the page.

     

    for example, in the cisco index.html may have several objects such as image, css. if they are using absolute path, no change is needed. anyway, if they are using relative path, you have to add /web/partners/ (because it is related to /web/partners/ not /).

     

    hope this helps.

     

    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      Hello Nitass, I have tried that option but not working, please find the below iRule I am also attaching the iRules which I have tried. when HTTP_REQUEST { HTTP::collect NAME::lookup www.cisco.com/ } when NAME_RESOLVED { if { [HTTP::uri] eq "/try" } { HTTP::header replace Host "www.cisco.com/web/partners/" HTTP::uri "/" node [NAME::response] 80 } else { pool foo1 } snat automap HTTP::release }
    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      i Rule 2 when RULE_INIT { set doSSL 0 } when HTTP_REQUEST { HTTP::header remove "Accept-Encoding" switch [string tolower [HTTP::host]] { "shop.company.com" { if {([HTTP::path] eq "/")} { HTTP::header replace Host "company.force.com" HTTP::uri "/shop/" } pool company.force.com } default { } } } when SERVER_CONNECTED { log local0. "pool [LB::server pool]" if {[string tolower [LB::server pool]] contains "company.force.com" } { SSL::enable serverside } else { SSL::disable serverside log local0. "ssl disabled" } }
    • Ashish_Ram_Tak1's avatar
      Ashish_Ram_Tak1
      Icon for Nimbostratus rankNimbostratus
      iRule 3 when HTTP_REQUEST { set host_header_value "http://company.force.com/" if {([HTTP::host] contains "shop.company.com")} { HTTP::header replace Host $host_header_value HTTP::uri "/shop/" log local0. "[IP::client_addr]:[TCP::client_port]: Replaced Host header with $host_header_value." pool company.force.com } else { } } when HTTP_RESPONSE { if {([HTTP::header exists "Location"]) && ([HTTP::header "Location"] contains "company.force.com")} { HTTP::header replace "Location" "http://shop.company.com" log local0. "Replaced Location header in response." } }
  • I have tried that option but not working

     

    what did you get from troubleshooting e.g. log, tcpdump, etc?