Forum Discussion

sstorholm's avatar
Icon for Nimbostratus rankNimbostratus
Mar 11, 2022

URL Rewrite in LTM Policy

I have an issue that after an update to a web application the IIS rewrite rules no longer work, so I thought I'd migrate the whole thing over the our F5s that are already doing TLS for the site. 

What I'm trying to do is the following: -> (alternatively ->

I already have a policy that matches the domain and forwards the request to the server in question, and the server listens to *:80

So the question becomes, what should I add to the policy to make it add the /appname/ part to the request, and also the language parameter for the different subpages. Also there's the edge case that the user might click on a link to change the language on the site itself, adding the ?language= parameter allover again, which should work. Aka. the following for example: ->

The site supports en, fi and sve incase it's of importance. 

Or do I need to go fullbore with iRules for this?

2 Replies

  • Hello, this is the most basic I can come up with assuming that finnish language append is optional.

    • I've wrote this on mobile, there might be typos, lmk


    when HTTP_REQUEST {

    set lan ""

    if {[HTTP::uri] ends_with "?language=en"}{

    set lan "?language=en"

    } elseif {[HTTP::host] eq "" }{set lan "?language=sve"}

     HTTP::header replace "Host" ""

    HTTP::uri "/appname/$lan" 


    • CA_Valli's avatar
      Icon for MVP rankMVP

      Reading request again I noticed you mentioned you have an ltm policy for host rewrite, eventually remove the http header instruction as it might clash with ltm policy statements

      (try not to have conflicts on instructions as is might result in unexpected behavior)


      also if finnish language is required you can change the default $lan value from "" to "?language=fin" at variable set instruction time,