Forum Discussion

6 Replies

  • Maybe something like this:

    when HTTP_REQUEST {
       set val1 [getfield [HTTP::uri] "/" 1]
       set val2 [getfield [HTTP::uri] "/" 2]
       set my_location "$val1.internalurl.com/$val2"
       HTTP::Respond 301 Location "$my_location"
       log local0. "Redirecting to $my_location"
    }
    

    Cheers.

  • Sorry - I missed the "http://" on the redirect.

    set my_location "http://$val1.internalurl.com/$val2"
    
  • Does the iRule change if the VS is HTTPS ? Also as the internalurl.com should be visible to the end user will the iRule take care for the http_respond back and remap the respond back to abc.externalurl.com?

     

    The reason I had in mind iRule is that it's more flexible and adding another context later would not be a problem. Where with clientside/serverside rewrite profile is static.

     

    • Stanislas_Piro2's avatar
      Stanislas_Piro2
      Icon for Cumulonimbus rankCumulonimbus
      The ltm does not select destination server base on his hostname. you must create one pool for each internal server. so you must change configuration for each new internal service to publish and assign it to the external URL.
  • Sorry - I made a typo. "... as the internalurl.com should NOT be visible to the end user will the iRule take care for the http_respond back and remap the respond back to abc.externalurl.com?"