Forum Discussion
Bob_10976
Nimbostratus
Sep 08, 2010Append to or Rewrite URI
Hello all...
We have launched ADFS in our network and we'd like to setup an iRule so that when a user goes to the website, mydomain.com, that an iRule either appends or rewrites the URI so that the it includes the realm for these users.It should look something like this: https://mydomain.com/Pages/SiteSpla...tion:Realm. The trick is that "?whr=urn:federation:Realm" needs to append to any and all URLs, so in case someone sends another person a link via email to go to the link https://mydomain.com/bob/home.aspx that the "?whr=urn:federation:Realm" is appended to that as well. Also since its' possible that some URLs will contain a "?" already then we have to account for that because, from my understanding, you can't have two "?" in the URI.
Also I was wondering is it possible that the "?whr=urn:federation:Realm" be added but not show up in the Browser, keeping the user's URL window clean of this appeand or rewrite?
Working with one of my dev folks we came up with this, which doesn't seem to work but I'm not sure where our issue is. If anyone has any suggestion or thoughts please let me know.
when HTTP_REQUEST {
switch "[string tolower [HTTP::host]]" {
"mydomain.com" {
if {not [string tolower [HTTP::uri]] contains "whr=urn:federation:Realm"}{
if {[string tolower [HTTP::uri]] contains "?"}{
HTTP::uri [append [HTTP::uri] "&whr=urn:federation:Realm"]
}
{
HTTP::uri [append [HTTP::uri] "?whr=urn:federation:Realm"]
} } } } }
Thanks in advance..
Bob
- hoolio
Cirrostratus
Hi Bob,if {not [string tolower [HTTP::uri]] contains "whr=urn:federation:Realm"}{
if {not ([string tolower [HTTP::query]] contains "whr=urn:federation:realm")}{
- Bob_10976
Nimbostratus
Aaron...when HTTP_REQUEST { switch "[string tolower [HTTP::host]]" { "domainname.com" { set lowerUri [string tolower [HTTP::uri]] if {$lowerUri contains "whr=urn:federation:Realm"}{ set hasWHR 1 } { set hasWHR 0 } if {!$hasWHR} { set newURI [HTTP::uri] if {[string tolower [HTTP::uri]] contains "?"} { append newURI "&whr=urn:federation:Realm" } { append newURI "?whr=urn:federation:Realm" } HTTP::uri $newURI } } } }
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