Forum Discussion
dlogsdonmd
Nimbostratus
Jan 09, 2017iRule URL/URI redirect question
Hello, we're implementing Jira in our environment and we want to redirect users and agents to different URIs. I'm trying to implement a rule to do the below:
If user enters: http://support.domain....
Kai_Wilke
MVP
Jan 10, 2017Hi dlogsdonmd,
a nested
[if] iRule structure shouldn't be that complex to setup. You may take a look to the syntax below to see how your initial requirement can be glued within a rather simple iRule...
when HTTP_REQUEST {
Parse the requested HOST-Name using lower case formating...
set low_host [string tolower [HTTP::host]]
if { $low_host equals "support.domain.org" } then {
Valid HOST-Name detected. Parse the requested PATH using lower case formating...
set low_path [string tolower [HTTP::path]]
if { $low_path starts_with "/customer" } then {
Redirect the request...
HTTP::redirect "https://support.domain.org/servicedesk/customer/portals"
} elseif { $low_path starts with "/agents" } then {
Redirect the request...
HTTP::redirect "https://support.domain.org/secure/Dashboard.jspa"
} else {
Allow the request?
}
} else {
Invalid HOST-Name requested
HTTP::respond 404 content "Unrecognized request to [HTTP::host][HTTP::uri]" "Content-Type" "text/html"
}
}
Note: The provided iRule uses a slightly more advanced syntax, by checking the requested Path/URI using lower case formating (more accurate).
Cheers, Kai
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