Forum Discussion

eagertolearn's avatar
eagertolearn
Icon for Nimbostratus rankNimbostratus
Dec 04, 2024

Retain the URL on Browser

Hello Team, 

 

We have a requirement , where we have to retain the URL on the browser as is , However at the backend (pool member) user hits land on the other URL/URI. For example:

Actual URL (hit by user) : 123.abc.com/test  (this has to be retain on user's browser , that is .. user should always see this URL on his browser).

 

At Backend (pool member) : This hit should forwarded or land on 123.XYZ.com/test (which is hosted on backend server).  

 

In short, For end user, URL should not be change anyway. 

 

Rgds

***

 

 

 

 

 

  • Hi Paulis


    Thanks, but it's not working with pool.

    Providing more clarity :


    1)   slight addition in the backend URL

    Actual URL (hit by user) - 123.abc.com/test1 ,   At Backend (pool member) : This hit should forwarded to 123.xyz-ha.com/test1

    For end user, URL should not be change and he can only see 123.abc.com/test1 on his browser.

     

    2)  addition and changes in URI 

    Actual URL (hit by user) - 123.abc.com/test1  , At Backend (pool member) - This hit should forwarded or land on 123.xyz-ha.com/hello/check12 


    For end user, URL should not be change and he can only see 123.abc.com/test1on his browser.

    • Paulius's avatar
      Paulius
      Icon for MVP rankMVP

      eagertolearn Number 2 contradicts Number 1. What is the reasoning of forwarding to the server on 123.xyz-ha.com/test1 to then just forward it to 123.xyz-ha.com/hello/check12 instead? Can you please provide your virtual server configuration to see if I missed anything because the above iRule should work for the original purpose.

      • eagertolearn's avatar
        eagertolearn
        Icon for Nimbostratus rankNimbostratus

        Hi Paulius, 

         

        123.xyz-ha.com/hello/check12 is just the backend URL, But application team want to access it using 123.xyz-ha.com/test1  from browser.

  • eagertolearn The following iRule should be what you want. I did not put "XYZ" in capitalized letters because I believe the RFC states that the host section will always come across as lower case.

    when CLIENT_ACCEPTED priority 500 {
    
        set DEFAULT_POOL [LB::server pool]
    
    }
    
    when HTTP_REQUEST priority 500 {
    
        if {[string tolower [HTTP::host]] == "123.abc.com" } {
    
            HTTP::host [string map {"abc" "xyz"}[HTTP::host]]
            pool ${DEFAULT_POOL}
    
        }
    
    }