Forum Discussion
Ten_92952
Nimbostratus
Sep 03, 2010Redirect HTTP to HTTPS for some users
I have a need to redirect any external users that try to access a web site via HTTP to HTTPS.
I also need to allow internal users to access the exact same site via both HTTP AND HTTPS.
I was using this irule to redirect outside users to HTTPS
when HTTP_REQUEST { HTTP::redirect https://[HTTP::host][HTTP::uri] }
I then had inside users go to a different virtual server that used the same nodes but did not do any redirecting.
This does not work, it appears the irule is redirecting eveything to HTTPS.
Is thre a way I can write the irule to not redirect any devices with a particular source subnet ( say 10.3.4.0/24) and redirect anything else to HTTPS?
Or is there a better way to accomplish this?
Thanks in advance for your help.
- Chris_Miller
Altostratus
I like to use data groups in situations like this. You can make an address-type data group that contains the subnets you don't want to redirect. If you're using 10.x, your iRule will look something like this:when HTTP_REQUEST { if { [TCP::local_port] eq 80 and ![class match [IP::client_addr] eq datagroup] } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
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