Forum Discussion
Gbps_31870
Nimbostratus
Jun 10, 2012Re-write HTTP host iRule
Hi,
I would like to know if it is possible to re-write the HTTP host header by F5, and send it to one server. Then, once the server response is received, re-write the HTTP host header again to the original HTTP host value and send it back to the client. Appreciate your help.
5 Replies
- Richard__HarlanHistoric F5 AccountYea it should be no problem
when HTTP_REQUEST {
HTTP::header replace Host "newhost.example.com"
}
when HTTP_RESPOND {
HTTP::header replace Host "oringal.example.com"
} - Gbps_31870
Nimbostratus
Thanks Richard for your input ,, I will give it a try and update with the result ,, - nathe
Cirrocumulus
Gbps / Richard
I don't think there's a HTTP_RESPOND event - I doubled checked the Wiki. But, I don't think even using HTTP_RESPONSE would work as there isn't a host header in the response.
Hoolio (as always) has answered a similar request here using the stream command:
https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1167408/showtab/groupforums/Default.aspx
Hope I'm not mistaken and hope this helps.
N - hoolio
Cirrostratus
Hi Nathan,
You're correct. Thanks for linking the other thread with the example. Gbps, if you get stuck with that example reply here with details on the iRule you're testing and what's not working.
Aaron - Richard__HarlanHistoric F5 AccountYou are right I meant
when HTTP_RESPONSE {
As for the host header in the response most likely the rewrite would be for the location field if the server is redirecting the client which would rewrite the browser URL. I did not read the question too closely. Though the header replace can be done using the iRUle it could also be done using HTTP classes.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
