Forum Discussion

galou_31358's avatar
Icon for Nimbostratus rankNimbostratus
Jun 14, 2011

transform juniper redirector and cluster to VS using irule

Hi all


I'm new in iRule developping, i would like just transforming this redirector and cluster Juniper DX to a virtual server.



Do i need to create to 2 VS, one VS for redirect using an irule and a second standard VS with snat automap?



In this configuration, the user is redirected from to the cluster with a new URI:new_uri/test



set cluster foo listen vip


set cluster foo listen netmask


set cluster foo listen port 8080


set cluster foo target host


set cluster foo target name




set redirector foo listen netmask


set redirector foo listen port 80


set redirector foo name foo


set redirector foo listen vip


set redirector foo port 8080


set redirector foo protocol http


set redirector foo host


set redirector vega customurl new_uri/test



Thanks for your help.


5 Replies

  • It would be simpler to create one HTTP VS on port 80 and another on port 443. The pool for the HTTPS VS would contain the server IP:port

    You can use an iRule like this to redirect requests to the HTTP VS to HTTPS:

    when HTTP_REQUEST {
       HTTP::redirect ""

  • Hi Aaron


    Thanks but the second VS should use port 8080 on http protocol.


    So how can i transform the iRule?



  • You could use this if the second VS is HTTP on port 8080:

    when HTTP_REQUEST {
       HTTP::redirect ""

  • Thanks Aaron.


    is it the same if i use this iRule:


    when HTTP_REQUEST{


    virtual foo8080


    HTTP:uri "new_uri/test"


  • Colin_Walker_12's avatar
    Historic F5 Account
    A redirect and the HTTP::uri command are different. If you want to just replace the URI for this particular request between the LTM and the back end servers, HTTP::uri will do just that. However, if you want to issue a redirect to the client so they make a new connection to a different specified host/URI and permanently move the transaction over to that location, then HTTP::redirect is your ticket.