Forum Discussion
done_23947
Nimbostratus
Apr 07, 2011restrict public access
I need help w/ a iRule.
I have two URL's, https://ssb.xx/ODSP/twbkwbis.P_ValLogin and https://ssb.xx/PROD/twbkwbis.P_WWWLogin.
Both use same public IP address VIP.
I would like to allow public Internet access to one but not the other. And allow only private addresses (internal users) 10.233.x.x to the non public URL. Thanks
10 Replies
- Michael_Yates
Nimbostratus
Hi Done,
Your [HTTP::host] value appears to be the same for both URL's so I am making an assumption and using the [HTTP::uri].
I don't know how many internal subnets you have so I also made the assuption that you might want to use a Data Group so that you can add additional subnets in the future.
This written for v10:
Create a Data Group (Local Traffic -> iRules -> Data Group List) and add the Networks you want to allow to the /PROD into it.when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/prod" } { if { ![class match [IP::client_addr] equals InternalNetworkList ] } { Take Action Here. HTTP::redirect " https://ssb.xx/ODSP/twbkwbis.P_ValLogin" } } }
Hope this helps or gets you started. - done_23947
Nimbostratus
Thanks much but I think I need something more basic. One Virtual Server and two url's
"https://ssb.xx/ODSP/twbkwbis.P_ValLogin" and "https://ssb.xx/PROD/twbkwbis.P_WWWLogin".
If "https://ssb.xx/PROD/twbkwbis.P_WWWLogin" allow only internal users 10.x.x.x
Thanks again - Chris_Miller
Altostratus
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/prod" and ![IP::addr [IP::client_add] equals 10.233.0.0/16] } { discard } }
That will check if the URI starts with prod. If it starts with prod and the user's IP isn't in the 10.233.0.0/16 network, it'll discard the request.
Is that what you wanted? Like Michael, I also like to use data groups here for scalability but if this is all you need, perhaps it'll suffice. - done_23947
Nimbostratus
That look good. thanks very much. - done_23947
Nimbostratus
Sorry, I'm new to iRule. Getting following error in irule editor.
line2:[undefined procedure:IP::client_add][IP::client_add]
LTM version is "BIG-IP 10.0.1 Build 378.0 Hotfix HF3 " - hoolio
Cirrostratus
It's just missing an r on IP::client_addr.
Aaron - done_23947
Nimbostratus
Sorry I didn't see that. Will test it this weekend. thanks much. - Chris_Miller
Altostratus
Hah - maybe we should get a compiler built into posts so I can validate that stuff before clicking submit. - Michael_Yates
Nimbostratus
Spell Check! Spell Check! (with custom library for TCL Commands and iRule Lingo). - Spell check would be great..
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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