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

Kamleshwar_2732's avatar
Kamleshwar_2732
Icon for Nimbostratus rankNimbostratus
Jun 22, 2016

Irule required for mentioned url

Hello,

 

Need an Irule for mentioned url -

 

When we call urls starting with http://uat-alfresco-euro.kamlesh.com:2095/alfresco/webdav it should call http://uat3.alfresco-euro.kamlesh.com:2095/alfresco/webdav

 

For example, if I try to reach in my browser http://uat-alfresco-euro.kamlesh.com:2095/alfresco/webdav/test/123 VIP should call http://uat3.alfresco-euro.kamlesh.com:2095/alfresco/webdav/test/123

 

Original URL should be kept and not be replaced

 

Note- In url there is - uat and uat3(after redirection) and

 

Original URL should be kept and not be replaced.

 

Kindly help for redirection of url Thanks in advance

 

Regards Kamlesh Y

 

3 Replies

  • Hi,

     

    You can try an irule simmilar to below code :

     

    when HTTP_REQUEST {
        if { [HTTP::host] contains "uat-alfresco-euro.kamlesh.com" } {
            HTTP::redirect http://[string map { "uat-alfresco-euro.kamlesh.com" "uat3.alfresco-euro.kamlesh.com" } [HTTP::host]][HTTP::uri]
        }
    }

    This is a simple redirect. Just saw that you need to rewrite the host header so Stefan's irule is correct. But you may need to rewrite the response body to make sure that uat3.alfresco-euro.kamlesh.com is not visible from external.

     

  • Hi Kamlesh,

    if you want that the original URL in your browsers address bar shouldn't be changed, then we are talking about URI rewriting instead of HTTP redirect. So in your example you want to exchange the host-part of your URL/request. Please try this one:

    when HTTP_REQUEST {
         Replace host header with the internal name
        HTTP::header replace Host uat3.alfresco-euro.kamlesh.com:2095
    }
    

    Please also have a look on the ProxyPass Lite iRule in case you might need to rewrite something in responses from the server as well. Hope that helps.

    Ciao Stefan 🙂

  • If you are trying to mask the domain name, try this:

    when HTTP_REQUEST {
    if { [HTTP::host] contains "uat-alfresco-euro.kamlesh.com" } {
    HTTP::host [string map {"uat-alfresco-euro.kamlesh.com" "uat3.alfresco-euro.kamlesh.com"} [HTTP::host]] 
    }
    
    when HTTP_RESPONSE {
    if { [HTTP::header values Location] contains "uat3-alfresco-euro.kamlesh.com" } {
    HTTP::header replace Location [string map {"uat3-alfresco-euro.kamlesh.com" "uat.alfresco-euro.kamlesh.com" [HTTP::header value Location]]
    }
    }