Forum Discussion
host replace question with iRule
Is there any way to keep F5VSserver.null.com as the host? Would using HTTP::host be an option?
client request
when HTTP_REQUEST { log local0. "xyz_Forms = [HTTP::uri]"
if { [string tolower [HTTP::uri]] contains "xyz" } { set uri [string map -nocase {"/?uri=; "/xyz/"} [HTTP::uri]] log local0. "xyz_new = $uri" HTTP::uri $uri } }
http://Server2.null.com:8000/http_handler/file.htm being the final result as expected.
- Vernon_97235Historic F5 Account
I'm not 100% sure I understand the question, but breaking down the original client request:
https://f5VSserver.null.com/?uri=http://Server1.null.com/xyz/go?app_url=http://Server2.null.com:8000/http_handler/file.htm
would create an HTTP Request message that looks something like this:
GET /?uri=http://Server1.null.com/xyz/go?app_url=http://Server2.null.com:8000/http_handler/file.htm HTTP/1.1 Host: f5VSserver.null.com ... other headers here ...
Unless you use a Local Traffic Policy or iRule to modify the Host header, it will remain unchanged as the HTTP Request message is proxied to the selected Pool Member. The only thing your rule is modifying is the Request Target (aka, the Request URI) which is the field immediately after the GET method in the start-line. The requested hostname is not part of the Request Target.
- daveclarkjrNimbostratus
sorry if I wasn't clear I'm looking for a way to get the return of
https://f5VSserver.null.com/http_handler/file.htm
and not http://Server2.null.com:8000/http_handler/file.htm
I know my iRule will give me the second result, just wasn't sure if anyone knew of a way to do this.
- VernonWellsEmployee
I'm not 100% sure I understand the question, but breaking down the original client request:
https://f5VSserver.null.com/?uri=http://Server1.null.com/xyz/go?app_url=http://Server2.null.com:8000/http_handler/file.htm
would create an HTTP Request message that looks something like this:
GET /?uri=http://Server1.null.com/xyz/go?app_url=http://Server2.null.com:8000/http_handler/file.htm HTTP/1.1 Host: f5VSserver.null.com ... other headers here ...
Unless you use a Local Traffic Policy or iRule to modify the Host header, it will remain unchanged as the HTTP Request message is proxied to the selected Pool Member. The only thing your rule is modifying is the Request Target (aka, the Request URI) which is the field immediately after the GET method in the start-line. The requested hostname is not part of the Request Target.
- daveclarkjrNimbostratus
sorry if I wasn't clear I'm looking for a way to get the return of
https://f5VSserver.null.com/http_handler/file.htm
and not http://Server2.null.com:8000/http_handler/file.htm
I know my iRule will give me the second result, just wasn't sure if anyone knew of a way to do this.
- VernonWellsEmployee
Ah, so I assume what you really want is to change what comes after app_url= in the Request Query Parameters. Assuming that is the case, you can simply extend the
set:string map
when HTTP_REQUEST { log local0. "xyz_Forms = [HTTP::uri]" if { [string tolower [HTTP::uri]] contains "xyz" } { set uri [string map -nocase { "/?uri=http://Server1.null.com/xyz/" "/xyz/" "Server2.null.com:8000" "[HTTP::host]" } [HTTP::uri]] log local0. "xyz_new = $uri" HTTP::uri $uri } }
That would change this Request Target:
/?uri=http://Server1.null.com/xyz/go?app_url=http://Server2.null.com:8000/http_handler/file.htm
into this:
/xyz/go?app_url=http://f5VSserver.null.com/http_handler/file.htm
assuming that the Host header is set to f5VSserver.null.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