Forum Discussion
jacob900_39797
Nimbostratus
May 07, 2007mutliple redirect with uri insertion
I need some help doing a multiple http-tohttps redirect with uri inserstion. I have been working with test script..unsucessfully so far.
when HTTP_REQUEST {
if {[HTTP::host] eq "app1.abc.com/"}{
HTTP::redirect https://company.abc.com/app1
}
elseif
{[HTTP::host] eq "app2.abc.com/"}{
HTTP::redirect https://company.abc.com/app2
}
elseif
{[HTTP::host] eq "app3.abc.com/"}{
HTTP::redirect https://company.abc.com/app3
}
}
Goals: redirect these links and add the uri...
app1.abc.com > https://www.company.com/app1
app2.abc.com > https://www.company.com/app2
app3.abc.com > https://www.company.com/app3
Any help is defintely appreciated.
1 Reply
- hoolio
Cirrostratus
HTTP::host is the host of the request (like app1.abc.com or www.company.com). It wouldn't include any portion of the URI like the forward slash you have included. HTTP::uri would be the URI, including the query string.
So if you want to redirect all requests via HTTP to HTTPS you can remove the trailing forward slash on the HTTP::host comparison. For example:... if {[HTTP::host] eq "app1.abc.com"}{ ...
You can add logging statements to see exactly what is being parsed:log local0. "\[HTTP::host\]: [HTTP::host]; \[HTTP::uri\]: [HTTP::uri]"
Aaron
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