Forum Discussion
iRule, Traffic Policy or Re-Write Policy
- Sep 24, 2025
you may see https://hostnameA.test.com:666 in the browser for many reasons
thats why I am asking if there is a redirect response (301 or 302) or there is something else
anyway give this a trywhen HTTP_REQUEST { STREAM::disable HTTP::header remove "Accept-Encoding" if {[IP::addr [IP::client_addr] equals 192.168.1.1] } { pool POOL_A set selected_hostname "hostnameA.test.com" HTTP::header replace Host $selected_hostname } elseif {[IP::addr [IP::client_addr] equals 192.168.2.1] } { pool POOL_B set selected_hostname "hostnameB.test.com" HTTP::header replace Host $selected_hostname } elseif {[IP::addr [IP::client_addr] equals 192.168.3.1] } { pool POOL_C set selected_hostname "hostnameC.test.com" HTTP::header replace Host $selected_hostname } } when HTTP_RESPONSE { if {[HTTP::header exists "Location"] && [info exists selected_hostname]} { set loc [HTTP::header "Location"] if {[string match "https://$selected_hostname:666*" $loc]} { HTTP::header replace "Location" [string map "https://$selected_hostname:666 https://example.com" $loc] } } if {[HTTP::header "Content-Type"] contains "text" && [info exists selected_hostname]} { STREAM::expression "@https://$selected_hostname@https://example.com@" STREAM::enable } }
Thats correct, a single uri to servers on different subnets
I have a number of pools, each has a specfic node in it, listening on a port - 666
Each pool has a remote test client that connects to the pool
I'd like all test clients to hit the same uri of https://example.com then be redirected to a specific server (based on their source IP)
client 1 uses 192.168.1.1
goes to pool A and https://example.com redirects to hostnameA.test.com:666
client 2 uses 192.16821
goes to pool B and https://example.com redirects to hostnameB.test.com:666
client 3 uses 192.16821
goes to pool C and https://example.com redirects to hostnameC.test.com:666
I want the node name to remain hidden from client, currently I see the server name in the response, I just want the client to only ever see https://example.com if possible
Thanks again
- Injeyan_KostasSep 24, 2025
Nacreous
it's not clear to me yet
Is the pool B server (for example) responds with a redirect or you mean that you need a host header rewrite because server listens only to hostnameB.test.com?
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