Forum Discussion
rjones_01_14578
May 30, 2014Nimbostratus
HTTP redirect with URI replacement without using [http::host]
I am redirecting a https request when uri /ExampleWeb* is requested it is changed to /ExampleWeb/test* then is being redirected to http (all other uri will stay https). The issue I am having is that...
nitass_89166
Noctilucent
I am redirecting a https request when uri /ExampleWeb* is requested it is changed to /ExampleWeb/test* then is being redirected to http.
if i understand correctly, you do not need HTTP::redirect command. you just create http pool and assign to virtual server.
The issue I am having is that when it is being redirected using [http::host] the server in the pool doesn't have the host in its directory.
you can use HTTP::header to change host header value.
HTTP::header replace Host (new host header value)
rjones_01_14578
May 30, 2014Nimbostratus
Thanks nitass. This is what I ended up using. There is probably a better cleaner way to do this (I'm new to irules) but it is working as expected now.
when HTTP_REQUEST {
if {[HTTP::uri] contains "/ExampleWeb"}{
log "Requested URL is [HTTP::host][HTTP::uri]"
HTTP::uri [string map {"/ExampleWeb" "/ExampleWeb/test"} [HTTP::uri]]
switch -glob [HTTP::path] {
"ExampleWeb/test*" {
virtual test-instance-80
}
}
}
}
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