Forum Discussion
Need to restrict access to URLs
iRule What would you like the action to be if the request to the virtual server (VS) isn't xyz.com? If you want it to just go to the default pool associated to the VS then the following iRule should work for your purposes. Please keep in mind that you will have to be performing SSL termination on this VS otherwise you will not be able to do anything with the HTTPS traffic at the HEADER level. Additionally, you will need to create two data-groups, one for your companies private IP space and the other with the 29 URI paths without the * at the end. The data-groups are called CLASS-private_net for the private IP space and the other is CLASS-xyz.com for the URI paths for xyz.com.
when CLIENT_ACCEPTED priority 500 {
set DEFAULT_POOL [LB::server pool]
}
when HTTP_REQUEST priority 500 {
set URI [string tolower [HTTP::uri]]
if { [HTTP::host] == "xyz.com" } {
if { [class --match [IP::client_addr] equals CLASS-private_net] } {
${DEFAULT_POOL}
} elseif { !([class --match ${URI} starts_with CLASS-xyz.com]) } {
HTTP::respond 301 Location "https://https://oldapplication.com/${URI}"
}
} else {
$DEFAULT_POOL
}
}
Recent Discussions
Related Content
* 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