Forum Discussion
K-Dubb
Nimbostratus
Jan 19, 2012Friendly URI Re-Write based off of User-Agent?
Hi everyone,
I was wondering if it is possible to do a URL Re-write based off the user-agent of the browser?
For instance, we have users that come in on url1.domain.com and are then redirected to url2.domain.com at the website level. The SSL cert is based off of url2.domain.com, and url2.domain.com is what the user sees in the browser.
We would like for a user that makes a request to any pool to always show the friendly url1.domain.com if their user-agent is of type Mozilla, or TestAgent. So in the browser the user would always see url1.domain.com with no SSL error, and on the back end they will still be redirected as usual.
Is this possible? How can it be done?
Thank you!
- hoolio
Cirrostratus
Hi, - Chris_Phillips
Nimbostratus
if the cn on the cert if for "url2" then if their browser sauys "url1" and they are using an SSL connection with that cert, then they will always see an error. I don't really understand what you're asking to happen, but as you've mentioned the cert names etc, I think it must be the case that you somehow want the ssl connection to be "happy" despite it being for the wrong domain... You do sound like you are using internal redirection, as opposed to a 302, but then I'd not call that a "friendly" rewrite as the user would be oblivious to it. - K-Dubb
Nimbostratus
Sorry if I am not being clear. I was told this could be done, at the F5 level, but now I am not so sure. - K-Dubb
Nimbostratus
The F5 does not need to do any redirecting outside of what it normally does. - Chris_Phillips
Nimbostratus
OK, well SSL aside for now, can you be more specific about your use of the word "redirect"? A redirect would generally be taken to be sending an HTTP 302 redirect response back to the client and have them come back again asking for a different resource. A rewrite, however, would generally be the manipulation of the existing request to do something other than what was originally requested. - K-Dubb
Nimbostratus
Use of word redirect: We have an application we wrote on the backend that will look for a client coming in one URL, and redirect them to another. In the browser this is a 302. This helps us put the client on different versions of the application wiithout having to tell them a new URL each time. - Chris_Phillips
Nimbostratus
So, currently you are sending back a 302 and want to make this not occur my pre-empting the destination that they will be redirected to and instead rewrite the incoming request? So when you say "The application to not see the redirect" you mean "The application to not need to provide the redirect", right? So what does this not satisfy?...when HTTP_REQUEST { if { (string tolower [HTTP::header "User-Agent"] contains "mozilla") || (string tolower [HTTP::header "User-Agent"] contains "testagent") } { pool aaa HTTP::header replace "Host" "url2.domain.com" } else { pool zzz } }
- K-Dubb
Nimbostratus
Thanks for the help Chris, I am probably not good at explaining this. Correct, I do not want the client to see the redirect (but it is still going to happen on the backend). - Chris_Phillips
Nimbostratus
I don't see why the redirect (i.e. an actual 302) is going to still happen. In theory the LTM could intercept a 302 and act upon it itself, but if you can anticipate that situation, you'd just do a rewrite in the first place. - K-Dubb
Nimbostratus
I think we still have a disconnect. We need the application to see this initial URL only. We still need the redirect to happen on the backend (this is not done on the bigip), but we just need the browser to only see the URL that it comes in on (url1.domain.com), and not the redirect to url2.domain.com. We need this to be dynamic so it works across all pools. In other words, if this agent comes in on this url, then make sure the url is displayed as that url for the entire session and don't show the redirect.
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