Forum Discussion
HTTP to HTTPS Redirection
I have 2 Virtual Servers, one for port 80 and the other for port 443. In VS:80 there's an irule configured: when HTTP_REQUEST { if { [HTTP::uri] contains "/inscripcion-web/"} { pool pool_.93y.94_8690_inscripcion-web
I want that the service "inscripcion-web" to be attendeb by HTTPS.
I created a new pool for the service, created a new irule in it: when HTTP_REQUEST { if { [HTTP::uri] contains "/inscripcion-web/"} { pool pool_.93y.94_8691_inscripcion-web
When associating a http profile to the VS, it stops responding from internet.
My solution is: Create a new VS with a different secure port, associate a http profile and apply this irule: when HTTP_REQUEST { if { [HTTP::uri] contains "/inscripcion-web/"} { HTTP::redirect "https://www.icfesinteractivo.gov.co:XXX/inscripcion-web/”
This would redirect everything that contains the uri specified to HTTPS right? I'm not sure if that is going to make the request go to the nodes in the 443 VS.
any advice?
3 Replies
- Kevin_Stewart
Employee
This rule (slightly modified):
HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "/inscripcion-web/" } { HTTP::redirect "https://www.icfesinteractivo.gov.co:XXX/inscripcion-web/” } }Will catch any request with "/inscripcion-web/" in the URI and explicitly redirect the user to another URL - presumably another SSL VIP.
If you wanted the server hosting the "/inscripcion-web/" information to be SSL, while the rest of the site is not, you can:
- Create a pool for this server - servers listening on 443 or other encrypted port
- Apply a server SSL profile to the VIP
- Apply HTTP and OneConnect profiles to the VIP
-
Add an iRule like this:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "/inscripcion-web/" } { pool pool_.93y.94_8691_inscripcion-web } else { SSL::disable serverside pool pool_.93y.94_8690_inscripcion-web } }
- The_Bhattman
Nimbostratus
HI Acgutierrez,
Have you considered using the switch statement. It's more efficient then IF-ELSEIF-ELSE statements
=Bhattman=
- The_Bhattman
Nimbostratus
Take a look at the following WIKI about it
https://devcentral.f5.com/wiki/irules.switch.ashx
-=Bhattman=-
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