Forum Discussion

david0512_20548's avatar
david0512_20548
Icon for Nimbostratus rankNimbostratus
Oct 09, 2014

http redirect issue with $ character

Hi All

I have the following redirect setup and it seems to work aprt form when the $ character is inserted into the rule.

   when HTTP_REQUEST {
      if { [HTTP::host] equals "www.thiswebsite.com" and [HTTP::uri] starts_with "/t/$1" } {
                HTTP::redirect "http://www.thiswebsite2.com/www.thiswebsite.com/t/$1"
                            }
                     }

The problem however is that the virtual server responds with a receive failure. There is something about the $ that the F5 VS doesnt like.

Any pointers would be appreciated

  • The $1 is being treated as a variable. Escape the dollar-sign in both locations with a "\" to match "$1":

    /t/\$1

  • The $1 is being treated as a variable. Escape the dollar-sign in both locations with a "\" to match "$1":

    /t/\$1

  • shaggy's avatar
    shaggy
    Icon for Nimbostratus rankNimbostratus

    The $1 is being treated as a variable. Escape the dollar-sign in both locations with a "\" to match "$1":

    /t/\$1

  • are you just wanting to change the host destination? this might work if you are keeping the URI the same . when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "bigdog.some.domain" } { HTTP::respond 301 Location "http://www.Lildog.com[HTTP::uri]" } }