Forum Discussion

N__197982's avatar
N__197982
Icon for Nimbostratus rankNimbostratus
Jul 25, 2018

HTTP URL to be redirect, but hidden from the client.

Guys,

 

At present, our clients are going to request the URL https://www.oldsite.com/supportus/.pdf. We want to forward this request to https://www.mysite.com/nextgen/new/sales/.pdf.

 

However, the main request here is to keep the redirect URL hidden from the end customer.

 

With some suggestion we received here is the iRule in place for this request:

 

when HTTP_REQUEST { if { [HTTP::uri] starts_with "/supportus/" } { HTTP::header replace "Host" ";; log local0. "New host: [HTTP::host]" set uri [string range [HTTP::uri] 11 end] HTTP::uri "/nextgen/new/sales/$uri" log local0. "Final URI: [HTTP::uri]" } }

 

Now this iRule seems to work fine but the client fails to receive the page. The debug logs which mention:

 

log local0. "New host: [HTTP::host]" log local0. "Final URI: [HTTP::uri]"

 

shows the correct host and uri being set.

 

What could be breaking this? Do we need a HTTP_RESPONSE event as well? If yes, how should that be structured?

 

Thanks !!!

 

1 Reply

  • Hi,

     

    You should check the responses received by clients. Maybe there is a redirect to somewhere else that cause the failure on clientside or maybe there is a tcp reset from the backend server.

     

    Maybe you can try also using URI::basename to simplify your code.

     

    Regards

     

    Yann