Forum Discussion
Cory_Starr_1119
Nimbostratus
Sep 20, 2006redirect to v9.x rule
I have a v4.x rule I'm trying to migrate to v.9x
v4.x Rule looks like this:
if (client_addr == one of OPS_IP) {
use pool FS_OPS_Pool
}
else if (client_addr == one of Admin_IP) {
use pool FS8
}
else {
redirect to "http://my_url.com/accessdenied.htm"
}
v9.x Rule looks like this:
when CLIENT_ACCEPTED {
if { [matchclass [IP::remote_addr] equals $::OPS_IP] } {
pool FS-OPS
}
elseif { [IP::addr [IP::client_addr] equals $::Admin_IP] } {
pool FS-Prod
}
else discard
}
My question is what trick can I use to send a browser to another URL??
- hoolio
Cirrostratus
- JRahm
Admin
when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::OPS_IP] } { pool FS-OPS } elseif { [IP::addr [IP::client_addr] equals $::Admin_IP] } { pool FS-Prod } else { HTTP::redirect "http://my_url.com/accessdenied.htm" } }
- JRahm
Admin
Looks like Hoolio beat me to it! - JRahm
Admin
You're first rule had two conditions for getting traffic to a specific pool, whereas your new rule dumps every class-defined request into FS-Prod, so they are not identical functionally.. - Cory_Starr_1119
Nimbostratus
I'm getting this error - Yes, the HTTP::redirect command is only valid within a HTTP event.
- JRahm
Admin
Man, fit me for the dunce cap today! - Sean_Speegle_86
Nimbostratus
I have changed the rule a bit but it appears not to fire what am I missing? - hoolio
Cirrostratus
I think it would be simpler to put the whole rule in the HTTP_REQUEST event if you want to send an HTTP redirect. Also, the redirect should be in the else of the if/elseif/else chain so that clients that aren't in either class will be redirected.when HTTP_REQUEST { if { [matchclass [IP::remote_addr] equals $::OPS_IP] } { pool FS-OPS } elseif { [matchclass [IP::remote_addr] equals $::ADMIN_IP] } { pool FS-Prod } else { HTTP::redirect "http://myurl/accessdenied.htm" } }
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