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

jason_millan_40's avatar
jason_millan_40
Icon for Nimbostratus rankNimbostratus
Jun 09, 2016

ProxyPass URI Rewrite with wildcard matching

We are loooking to do some URI rewrites with the Proxypass irule that acheive the following:

 

  • ->
  • ->
  • ->
  • ->

so the unique part of the URI could be evergrowing in the order of thousands and will be dynamic hence a rule in the datagroup for each possible match is not suitable.

 

clients do not support redirects so proxy seems like the only choice.

 

datagroup strings like the following don't work either "hostA/pathA/*/" := "hostB/pathB/ Pool_B"

 

Any ideas ??

 

7 Replies

  • R_Marc's avatar
    R_Marc
    Icon for Nimbostratus rankNimbostratus

    What you have described is just a regex match and replace. Doesn't really require a data-group unless the pattern doesn't persist or is not something you can match on. Kinda looks like a one liner. Perhaps data groups could come into play if you had a host[a-x] mapping to host[A-X] and likewise with paths but still a regex should fill the gaps.

     

  • Hi,

    Below an irule that may help you to start :

    when HTTP_REQUEST {
        if { [HTTP::host] eq "hostA" } {
             can set hostname in v11.5+ otherwise, should use HTTP::header replace Host "hostB"
            HTTP::host "hostB"
        }
    
         Rewrite uri
        HTTP::uri "/pathB/[URI::basename]"
    }
    
    • jason_millan_40's avatar
      jason_millan_40
      Icon for Nimbostratus rankNimbostratus
      Gathering from the responses that ProxyPass iRULE doesn't support wildcarding so I am going to have to get dirty. I might borrow from ProxyPass how they do the streaming. Will reply back with updates and share the results!
  • Hi,

    Below an irule that may help you to start :

    when HTTP_REQUEST {
        if { [HTTP::host] eq "hostA" } {
             can set hostname in v11.5+ otherwise, should use HTTP::header replace Host "hostB"
            HTTP::host "hostB"
        }
    
         Rewrite uri
        HTTP::uri "/pathB/[URI::basename]"
    }
    
    • jason_millan_40's avatar
      jason_millan_40
      Icon for Nimbostratus rankNimbostratus
      Gathering from the responses that ProxyPass iRULE doesn't support wildcarding so I am going to have to get dirty. I might borrow from ProxyPass how they do the streaming. Will reply back with updates and share the results!