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

andrew_deackes_'s avatar
andrew_deackes_
Icon for Nimbostratus rankNimbostratus
Jul 18, 2014

odd behaviour with # in uri

Hi,

 

I have an irule performing various redirects. However, we've found that if the uri contains a after a / it matches a rule we don't want it to. For example:

 

https://www.company.coom/finance//isin:[{%22isin%22:%22HAU0123456%22

 

should not get redirected but is matching this:

 

elseif { [HTTP::uri] ends_with "/"} { HTTP::respond 301 Location "https://www.company.com[HTTP::uri]default.page" }

 

which ends up sending you to https://www.company.coom/finance/defautl.page/isin:[{%22isin%22:%22HAU0123456%22 which of course doesn't exist.

 

So why is / being treated as ends_with / and how do I stop this kind of uri getting caught by this rule?

 

thanks

 

A

 

2 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    "" is a fragment identifier that is supposed to be processed on the client side only. The [HTTP::uri] on the server side does the right thing by ignoring it as part of the URI when matching. But there seems inconsistency here, as the fragment also gets appended when "HTTP::respond 301 Locatin" is called, as part of URI.

     

    You can probably get at "" from the request header by calling HTTP::request and then parsing it.

     

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Here's a simple work-around:

    when HTTP_REQUEST {
        set test_uri [HTTP::uri]
    
        if { $test_uri ends_with "/" } {
            HTTP::respond 301 Location "http://www.company.com/docroot"
        } elseif { $test_uri eq "/xxxxx" } {
            HTTP::respond 301 Location "https://www.company.com/xxxxx"
        } else {
            set r "https://www.company.com[HTTP::uri]default.page"
            HTTP::respond 301 Location $r
        }
    }