Forum Discussion
tayyib_muzaina_
Nimbostratus
May 21, 2014How do I create an irule that rewrites a request to be translated to an ipaddress and port
How do I create an irule that rewrites a rule request to an ipaddress and port or translated to http://192.168.192.35/elasticsearch/ == http://192.168.192.35:9200/
Kevin_Stewart
Employee
May 21, 2014You should have a pool of servers listening on port 9200, and address and port translation are actually functions of LTM without an iRule. Otherwise, a non-standard port would show up in the incoming Host header, which is pretty straight forward to modify. I'm also adding the URI change code in the example below:
when HTTP_REQUEST {
if { not ( [HTTP::header Host] ends_with ":9200" ) } {
HTTP::header replace Host "[HTTP::heeader Host]:9200"
}
if { [HTTP::uri] equals "/elasticsearch/" } {
HTTP::uri "/"
}
}This will transparently replace the Host header and URI on incoming HTTP requests. Not sure if you meant to literally only change the URI and Host given a specific URI.
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
