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

dluzzi's avatar
dluzzi
Icon for Nimbostratus rankNimbostratus
May 03, 2018

URI redirect to different port

Hello,

I have the following scenario where I'm trying to edit the URI on the client side but doesn't exist on the web server.

1 VS with multiple hosts going to there respective pools.

Here is the current iRule config:

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::host]] {
            "api.site.com" {
                switch -glob [string tolower [HTTP::uri]] {
                    "/xyz/*" {
                        pool xyz
                    }   
                    default {
                        pool default
                    }
                }
            }
            "api-qa.site.com" {
                            switch -glob [string tolower [HTTP::uri]] {
                    "/xyz/*" {
                        pool xyzqa
                    }   
                    default {
                        pool defaultqa
                    }
                }
            }
           default {
            reject
            }
        } 
   }

What I need to do is create a URI that gets appended before the actual path to act as a redirect to a different port.

So for example api.site.com/abc/xyz that gets directed to pool abc with the different ports. However the server is still expecting to receive api.site.com/xyz. Everything I've tried I keep getting a 404 error as the internal server doesn't recognize /abc/xyz.

Is it possible to get /abc/xyz to get redirected on the webserver to go to /xyz and keep /abc/xyz as what the user sees in the browser?

1 Reply