Forum Discussion

numen_235631's avatar
numen_235631
Icon for Nimbostratus rankNimbostratus
Nov 24, 2015

remapping issue

Hi,

 

I need some help with irule (or any other solution that will help) I have to make my URLs shorter so I’m doing below remapping

 

`Code`
when HTTP_REQUEST {
HTTP::uri [string map -nocase {"/" "/xxxxx"} [HTTP::uri]]
}

Original link looks like that: https://link.domain.com/xxxxx and after remapping https://link.domain.com/

 

It causing one problem – logo image located on this site disappear after remapping So this is effect of this remapping https://link.domain.com/images/logo.png but it should look like that https://link.domain.com/xxxxx/images/logo.png

 

how can I prevent it? of course i want to make my link shorter but i want to exclude such behavior.

 

2 Replies

  • The

    string map
    substitutes every instance of / for /xxxxx. Thus, if the path-uri were /, it would change the path-uri to /xxxxx. If the path-uri were /foo/bar, it would change the path-uri to /xxxxxfoo/xxxxxbar. I believe what you are attempting to do is insert a path element at the start of any submitted path-uri, so that:

    Is that correct? If so, then you should be able to simply do this:

    when HTTP_REQUEST {
        HTTP::uri "/xxxxx[HTTP::uri]"
    }
    

    If you are using BIG-IP 11.4 or higher, you could also use a Local Traffic Policy:

    ltm policy expand-path {
        controls { forwarding }
        requires { http }
        rules {
            rule01 {
                actions {
                    0 {
                        http-uri
                        replace
                        path /xxxxx[HTTP::uri]
                    }
                }
                ordinal 2
            }
        }
        strategy first-match
    }