Forum Discussion
iRule - Add Host Header
Hello,
Currently we use the below iRule to route traffic from a 3rd party company, its been working great so far. But now we have set up a VPN tunnel with this 3rd party where there traffic is nat'd to the virtual servers ip, they are no longer coming in as test.domain.com/qa>VS IP>iRule routes to the appropriate pool. There coming in as for example as 10.1.1.1/qa>VS IP>iRule routes to the appropriate pool. The iRule is still routing correctly because its picking up the URL but because there not coming in as test.domain.com the host binding is not be picked up by IIS. Is there a way insert the host header and still route accordingly?
when HTTP_REQUEST { if {[HTTP::uri] contains "qa/test1" } { pool Pool_QA_test } elseif {[HTTP::uri] contains "prod/test1" } { pool Pool_Prod_test
} elseif {[HTTP::uri] contains "qa/test2" } {
pool Pool_QA_test
} elseif {[HTTP::uri] contains "prod/test2" } {
pool Pool_Prod_test
}
}
Thank you for your help!
- Faruk_AYDIN
Nimbostratus
Try this :
} elseif {[HTTP::uri] contains "qa/test2" } { HTTP::host test.domain.com pool Pool_QA_test } elseif {[HTTP::uri] contains "prod/test2" } { HTTP::host prod.domain.com pool Pool_Prod_test }
- Stanislas_Piro2
Cumulonimbus
Here is an optimized version of your Irule.
when HTTP_REQUEST { switch [HTTP::uri] { "qa/test1" - "qa/test2" { HTTP::host test.domain.com pool Pool_QA_test } "prod/test1" - "prod/test2" { HTTP::host prod.domain.com pool Pool_Prod_test } } }
HTTP::host command only modify host header without change of URI
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