Forum Discussion
Redirect when the client address is not equal to the networks in datagroup
Hello Santhosh.
Try this code instead:
if { not [class match [IP::client_addr] contains XYZ_group] } {
HTTP::respond 301 Location "http://rextrum.com/xyz"
}KR,
Dario.
- SanthoshApr 06, 2020
Nimbostratus
for some reason it's not liking the contains with in that. So I used equals but it's failing on redirection where it's throwing a error page.
- Dario_GarridoApr 06, 2020
Noctilucent
Sure, equals is OK.
when HTTP_REQUEST { if { not [class match [IP::client_addr] equals XYZ_group] } { HTTP::respond 301 Location "http://example.com/xyz" } }Test it from my lab and it's working fine.
I think your issue is in your data-group. Could you share the next command output (from TMSH)?
list ltm data-group internal XYZ_groupKR,
Dario.
- SanthoshApr 07, 2020
Nimbostratus
ltm data-group internal XYZ_group {
records {
10.0.0.0/8 { }
}
type ip
}
- SanthoshApr 07, 2020
Nimbostratus
Dario,
one more thing I forgot to mention is the Virtual server is a HTTPS on and the redirection site is HTTP. Does that causes any issue?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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