Forum Discussion
John_LeMay_1062
Nimbostratus
Sep 27, 2006Combining http_request and client_accepted?
I'm working on putting together what I think will be a relatively complex rule - at least it will be for me. So far my irule experience been limited to uri rewrites and redirects. However, I now have a need for something that will involve redirects, rewrites, and some additional logic. I believe I want to accomplish this all in one irule. Any tips would be welcome!
Here is what I am trying to accomplish:
- Client opens session to http://server
- When client accept, findstr against uri looking for "string"
- If "string" doesn't exist, change uri to what pool members expect to see
- Redirect client to https VS (using a client ssl profile to terminate ssl at LTM)
- Pool on https VS will consist of members listening on a non-std port
Some of what I want to do above would use when http_request, other parts would use when client_accept. Can these be somehow combined? References to using both in a rule I've seen in the forum seems to consistently result in errors.
Thank you!
6 Replies
Sort By
- hoolio
Cirrostratus
Hi, - John_LeMay_1062
Nimbostratus
Aaron, - The URI will never be an empty string. If you submit https://server, the browser will send a get for "/" the same as it would if you requested https://server/.
when HTTP_REQUEST { set uri [HTTP::uri] log local0. "URI is : $uri" if { $uri eq "" } { log local0. "URI is empty - this will never happen!" set uri "/path/path" pool pool_app_http81 } elseif { $uri eq "/" } { log local0. "URI is a slash" set uri "/path/path" pool pool_app_http81 } else { pool pool_app_http81 } }
when HTTP_REQUEST { if { [HTTP::uri] eq "/" } { HTTP::uri "/path/path" } }
when HTTP_REQUEST { if { [HTTP::uri] eq "/" } { HTTP::uri "/path/path" } pool pool_app_http81 }
- John_LeMay_1062
Nimbostratus
Wow, that greatly simplifies this process. I'm getting away from the original subject here, but I have one last piece of this and I believe I'll have a working site. - hoolio
Cirrostratus
This is what the rewrite redirects option on the HTTP profile was designed to handle. When a node sends an HTTP 3xx redirect, TMM can rewrite the Location header from HTTP to HTTPS. - John_LeMay_1062
Nimbostratus
Just wanted to follow up on this and thank everyone for the help! I still don't have the https piece working yet, but everything else is working. My rule ended up being a simple redirect instead of the complex beast I thought it would be.
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