Forum Discussion

vivekrane_30542's avatar
vivekrane_30542
Icon for Nimbostratus rankNimbostratus
Jan 08, 2017

HTTP Redirect with 302 response

Hello friends,

 

I am pretty new to irules. I want to set web portal servers behind f5 with initial authentication url http://xyz.com/index.jsp .whenever clients http request comes with any other url or rather than url http://xyz.com , want to give http response to client as HTTP/1.1 302 Moved Temporarily to Location http://xyz.com/index.jsp & redirect them towards http://xyz.com/index.jsp .basically any other http/https traffic i want to redirect to url http://xyz.com/index.jsp please help!!!

 

1 Reply

  • Many ways to solve this. If you do not intend to write your own iRules in the long term, look into LTM Local Traffic policies (no TCL coding required). In case of an iRule solution, here's how I'd approach the problem

    when HTTP_REQUEST {
    
        switch [HTTP::host][HTTP::path] {
            "xyz.com/" -
            "xyz.com/index.jsp" {
                 do not interferre
                return
            }
            default {
                 issue a temp 302 redirect
                HTTP::respond 302 Location "http://xyz.com/index.jsp"
            }
        }
    }