Forum Discussion
irule to change host and uri from response
I have created below iRule which is working fine with respect to client request
when HTTP_REQUEST { if { ([HTTP::host] == "abcd.client.com") and ([HTTP::uri] == "/") } { HTTP::header replace Host "abcd.supplier.com" HTTP::uri "/server can/respond/to/this/uri" pool Pool_supplier } }
but server redirect the request to different host/uri in response which client can see, and which we don't want. we want client to see the initial url on which request was initiated. for ex. client send request on abcd.client.com - F5 change the host header and uri to abcd.supplier.com/server can/respond/to/this/uri - server redirect response to new.supplier.com/new uri. The flow is working fine the only concern is to limit client to see abcd.client.com/uri
The F5 version is 11.6 HF6 Please suggest an iRule or other solution to fulfill the requirement
4 Replies
- nathe
Cirrocumulus
vsgrajput,
Would the Stream Profile help here? See SOL8115: Overview of the Stream profile
You could create a stream profile and in the Target box type in @abcd.client.com/@abcd.supplier.com/server can/respond/to/this/uri@
Hope this helps,
N
- vsgrajput_18926
Nimbostratus
Hi Nathan, Thanks for the response but I have achieved same from the below irule by changing the host header and uri when HTTP_REQUEST { if { ([HTTP::host] == "abcd.client.com") and ([HTTP::uri] == "/") } { HTTP::header replace Host "abcd.supplier.com" HTTP::uri "/server can/respond/to/this/uri" pool Pool_supplier } }
I think above iRule and suggested stream will do the same thing, the problem is server is redirecting request to different url and uri for eg. new.supplier.com/new uri which client can see.
Shall I try @abcd.supplier.com/server can/respond/to/this/uri@new.supplier.com/new rui@
please suggest !!
- vsgrajput_18926
Nimbostratus
For better understanding when HTTP_REQUEST { if { ([HTTP::host] == "abcd.client.com") and ([HTTP::uri] == "/") } { HTTP::header replace Host "abcd.supplier.com" HTTP::uri "/server can/respond/to/this/uri" pool Pool_isupplier } }
==========
when HTTP_RESPONSE { if { [HTTP::header] contains "new.supplier.com" } { HTTP::redirect "abcd.client.com" } }
The request portion is working as expected, need to something like this in response.
- Stanislas_Piro2
Cumulonimbus
Hi,
since version 11.4, rewrite can be done with rewrite profile.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com