Forum Discussion
Sams_88783
Nimbostratus
Apr 05, 2011Irule Help
I have created 2 VIP's.
1) VIP is with port 80 and nodes with port 8080
2) VIP is with port 8080 with irule
The requirement is VIP 2 with port 8080 to not have the hard coded domain names but to use the host variable without the port number. These rules should be redirecting to the default port for http.
The below irule will meet the requirement or not ? if not please suggest how to write the irule.
when HTTP_REQUEST
{ HTTP::redirect https://[HTTP::host][HTTP::uri] }
waiting for help at the earliest
3 Replies
- hoolio
Cirrostratus
Hi Sams,
So you want to redirect any request made to the VS:8080 to VS:80? If so, you can use getfield to remove the port and send the redirect:http://devcentral.f5.com/wiki/default.aspx/iRules/HTTPToHTTPSRedirect_301.html when HTTP_REQUEST { HTTP::respond 301 Location "https://[getfield [HTTP::host] : 1][HTTP::uri]" }
This strips the port number from the host header and sends a 301 to the new location. If you want to send a 302 instead, just change the status code in HTTP::respond.
If I've misinterpreted your scenario, let me know.
Aaron - Sams_88783
Nimbostratus
Hello Aron,
I want the VS:8080 not have the hard coded domain names but to use the host variable without the port number.
Also the redirection is to http:(VS:80)
Thanks,
Sam - Sams_88783
Nimbostratus
Hello Aron,
I Checked the devcentral link and found update as "apply this iRule ONLY to the port 80 HTTP-only virtual server"
The redirection irule requirement is from VS:8080 and not for VS:80
Thanks,
Sam
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