Forum Discussion
why F5 give me this error
looking for close parenthesis}][{($allowed == 0) and ([HTTP::uri] end_with "/register")}]
when CLIENT_ACCEPTED { set allowed 0 if { [ class match -- [whereis [IP::client_addr] country] equals "EG"] or [[ whereis [IP::client_addr] country ] not equals "EG" ] } { set allowed 1 } } when HTTP_REQUEST { if {($allowed == 0) and ([HTTP::uri] end_with "/register")} { HTTP::respond 403 content "Blocked!"} }
guys kindly advise
27 Replies
Just to summarize what the irule do :
- if Country=EG and path=/register then redirect to http://www.test.com/register
- if Country!=EG and path=/register then redirect to http://www.test.com/login
- if path!=/register then go to pool test
What is your exact issue now ?
Where is www.test.com located ?
Is it the same VS or another one ?
- ahmed_ismail_21
Nimbostratus
The redirect didn't work, the www.test.com located at Egypt, the same VS. I made test, I located at Egypt, and change redirect to be http://www.test.com/login, and open url which end with /register, but F5 didn't redirect me to www.test.com/login. - You should trace http request/response on your computer using httpwatch or fiddler for example. The provided irule works for me in my lab so I believe that you have another issue on your side
- Vijay_E
Cirrus
log local0. "[IP::client_addr] - [whereis [IP::client_addr] country ]"Add a log entry to see what the F5 is seeing:
when HTTP_REQUEST { set allowed 0 if { !([whereis [IP::client_addr] country ] equals "EG") } { log local0. "[IP::client_addr] - [whereis [IP::client_addr] country ]" set allowed 1 } if { ($allowed == 0) and ([HTTP::path] ends_with "/register") } { HTTP::redirect "http://www.test.com/register" } elseif { ($allowed == 1) and ([HTTP::path] ends_with "/register") } { HTTP::redirect "http://www.test.com/login" } else { HTTP::redirect "http://www.test.com/login" } }
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