Forum Discussion

5 Replies

  • Hi mj16othman , 

    > Try this : 

    when HTTP_REQUEST {
    if { [string tolower [HTTP::uri]] starts_with "/mortgage" } {
        HTTP::redirect "https://[HTTP::host]" 
    } 
    }
    

    > Or try this : 

    when HTTP_REQUEST { 
        if { [string tolower [HTTP::uri]] starts_with "/mortgage" } { 
            HTTP::respond 301 noserver Location "https://[HTTP::host]" 
            }
        }

    Note :  I would suggest the second iRule due to a 301 to minimize on repeat traffic from users. 301 is a permanent redirect and the browser will do an internal redirect next time the browser visits.

    Try it and give me the feedback. 
    Regards 

  • Hello,

    you can try this if you want to specify this hostname "oli.test.com" and the rest of the URL "/mortgage/default.aspx?clientid=1021".

    This to avoid if there is another hostname and also the rest of the URL starts with /mortgage and you don't need in this case to delete the rest of the URL

    when HTTP_REQUEST {
    if {([HTTP::host] equals "oli.test.com") and ([HTTP::uri] starts_with "/mortgage")}{
    HTTP::redirect "https://[HTTP::host]"
    }
    }

  • mj16othmanDo you mean no matter where they go on the website you always want them to only see https://oli.test.com? If that's the case that isn't possible because the URI path is how you navigate the website. Now if you just mean the first redirect that occurs this should be easy enough to accomplish by performing and HTTP rewrite between the LTM and destination servers. Please can you clarify which case it is that you are trying to solve for?

  • Hi mj16othman,

    to always stick the browser address bar to https://oli.test.com/ while the client is visiting your site. You would need to send the client an outer HTML page which opens an inner iFrame. The outer HTML basically stays for the entire browsing sessions and emulates an inner browser window. If the user clicks on a link, the iFrame will change the inner content as usuall... 

    You may either deploy such a HTML page on your webserver as default document or even as 404 response, or use the iRule below:

     

    when HTTP_REQUEST {
    	if { [HTTP::path] eq "/" } then {
    		set html_page {
    <html>
    	<body>
    		<iframe src="/mortgage/default.aspx?clientid=1021" style="border: 0; width: 100%; height: 100%" name="Your browser does not support iframes">
    	</html>
    </body>}
    
    		HTTP::respond 200 content $html_page "Content-Type" "text/html"
    	}
    }

     

     Cheers, Kai