Forum Discussion
Understanding one of the iRules I found on the devcentral links.
Folks,
We came across an request from the applications team where they wanted a VIP listening on port 8080(http) to forward requests on port 443(https).
I checked the plain HTTP to HTTPS redirect but that would not work. What was happening is the a URL e.g. http://test.nik.com:8080 was being redirected to https://test.nik.com:8080 and that was not what was desired.
While searching for some hints I found the below iRule which worked, however I do not understand the logic.
+++++++++++++++++++++++++++++++++++++++++++++++++ when HTTP_REQUEST { HTTP::redirect https://[getfield [HTTP::host] ":" 1]:443[HTTP::uri] } +++++++++++++++++++++++++++++++++++++++++++++++++
Any help? :-)
Thanks, N.
1 Reply
- Stanislas_Piro2
Cumulonimbus
To understand the irule, you must know how HTTP is parsed:
for the URL : http://test.nik.com:8080/test.txt the request is
GET /test.txt HTTP/1.1 Host : test.nik.com:8080 other headersin this request:
- HTTP::uri is /test.txt
- HTTP::host is test.nik.com:8080
- [getfield [HTTP::host] ":" 1] is the first part of HTTP::host with field separator ":" --> test.nik.com
this irule redirect to : https://test.nik.com/test.txt
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