Forum Discussion
iRule - Switch IP to Host Name
Hello,
We have a special case were we have a customer sending traffic by IP instead of host name. Instead of https://test.f5.com/api/example there hitting us as https://37.123.55.109/api/example. This was causing an issue for us in regards to the IIS/Bindings expecting but was getting an IP. I have attached the below iRule to the bip-ip 443 virtual server and traffic seems to be flowing, I'm getting a response back from server but now I'm getting an SSL error because the url still shows the IP. Is my iRule missing anything?
when HTTP_REQUEST { if {[HTTP::uri] contains "api/example" } { HTTP::host } }
Thank you for the help!
- nathe
Cirrocumulus
Would this irule help?
when HTTP_REQUEST { if { ( [HTTP::host] eq "37.123.55.109" ) and ( [HTTP::uri] starts_with "/api/example" ) } { HTTP::respond 301 Location "https://test.f5.com[HTTP::uri]" } }
Not got my lab fired up so would need to verify syntax and test.
Hope this helps,
N
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