Forum Discussion
Jas_44429
Nimbostratus
Dec 15, 2010irule for HTTP header rewrite
Hi,
Fairly new to F5's (as you can probably tell from the question) but I wish to write an irule which will:-
replace http://10.10.10.10/whatever1/whatever2.txt
with http://www.test.co.uk/whatever1/whatever2.txt
and forward the connection on to two internal servers. Our belief is that the internal servers need to see the connection arrive with the name and not the IP address!
This purely an intranet solution.
One solution is that we would change this at the source of the connection, but most client users would attempt to connect via IP address.
Any kind person able to offer what a possible irule would like like? Apologies if this is discussed elsewhere...
Thanks,
6 Replies
- hoolio
Cirrostratus
Hi Jas,
Welcome to DC. You can start with an iRule like this to replace the Host header in requests before they're sent to the pool:when HTTP_REQUEST { HTTP::header replace Host "www.example.com" }
If the servers each have a unique host header they're looking for, you can use an iRule and datagroup like this:
http://devcentral.f5.com/wiki/default.aspx/iRules/rewrite_host_header_to_server_name.html
Aaron - Jas_44429
Nimbostratus
You are the man!
That did it.
Thank YOU - Gbps_31870
Nimbostratus
Hi all,
I'm wondering if the above iRule will replace the HTTP header in the client side or just replace the http header and forward it to the internal server(s).
BR, - JRahm
Admin
it will just replace the header sent to the server. - Colin_Walker_12Historic F5 AccountIf you're looking to perform an actual client side redirect, wherein the client sees the new host address, you'll want to use the HTTP::redirect command.
Click Here
Colin - Gbps_31870
Nimbostratus
Thanks a lot Gurus,
Appreciate your feedbacks,
BR,
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