Forum Discussion
Reverse Proxy Setup
Hi I have an external URL...www.foxrun.com
I have 3 pool members aa1:80, aa2:80 and aa3:80
I configured a VIP foxrun:80 with pool of those 3 members
Each pool member has an internal url for the application on port 80
http://aa1.foxrn.com/ , http://aa2.foxrun.com/ , http://aa3.foxrun.com/
Now when the user hits www.foxrun.com and the VIP forwards to any of the available members but on seeing the www.foxrun.com in the payload the member server will drop the packets...
So i have to rewrite or replace the host name in the payload from www.foxrun.com to aa1.foxrun.com or aa2.foxrun.com etc. for which i have to use an irule..
Could some help me writing the irule..
Thanks in advance..
1 Reply
- cjunior
Nacreous
Hi,
I made an example to do this trick based on the server IP address. To do it with node's name, I think you must create a data group with servers name as values and IP as key then check it in switch statement. You must associate a stream profile in the VS. Regards.when CLIENT_ACCEPTED { ensures the server informations to the HTTP_REQUEST event. LB::connect } when HTTP_REQUEST { stores the current host header value set request_host "[HTTP::header Host]" checks the member by address:port switch "[LB::server addr]:[LB::server port]" { "10.10.10.1:80" { set rewrite_host "aa1.foxrun.com" } "10.10.10.2:80" { set rewrite_host "aa2.foxrun.com" } "10.10.10.3:80" { set rewrite_host "aa3.foxrun.com" } default { set rewrite_host "" } } If found, change their request. if { $rewrite_host ne "" } { STREAM::disable HTTP::header remove "Accept-Encoding" HTTP::header replace "Host" $rewrite_host } } when HTTP_RESPONSE { if { [HTTP::header value "Content-Type"] contains "html" and $rewrite_host ne "" } { replaces the content with the previous request host header STREAM::expression "@$rewrite_host@$request_host@" STREAM::enable } }
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