Forum Discussion
HTTPS to HTTP redirection from three external web urls to internal web urls using F5 as a revers proxy
we have three external web URLs which will come on our frontend f5 and need to redirect to internal web URLs and use as a reverse proxy.
External URLs: https://site3Ex.com Internal URLs: http://site3In.com
Redirection should be as below, traffic will be coming from 443 on the single Virtual server(public IP) and internal web URLs will work on different port 8080, 8082 and 8083.
https://site1Ex.com http://site1In.com:8080
https://site2Ex.com http://site2In.com:8081
https://site3Ex.com http://site3In.com:8082
how we can make iRule so, it will work also please confirm where we will define the internal web URLs on F5?
below is the internal web url IP address
http://site1In.com:8080 : 172.16.46.32
http://site2In.com:8081 : 172.16.40.253
http://site3In.com:8082 : 172.16.40.201
7 Replies
- Kevin_Stewart
Employee
An easy approach:
-
Create a separate pool for each site
pool1 contains 172.16.46.32:8080 pool2 contains 172.16.40.253:8081 pool3 contains 172.16.40.201:8082 -
Create an iRule
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "site1ex.com" { pool pool1 HTTP::host "site1.com" } "site2ex.com" { pool pool2 HTTP::host "site2in.com" } "site3ex.com" { pool pool3 HTTP::host "site3in.com" } } } -
Apply the iRule and client SSL profile to the VIP
-
- Lee_Payne_53457
Cirrostratus
Do all of the external sites work on the same IP or are they all discrete VIP's? If they are all discrete then it looks like adding the internal address as a pool member would do it (assuming you enable port address translation). If they are all on the same VIP then there are several ways to do it, either using a datagroup or a case select (to make it easier to add more in the future), something like:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] { "siteex1.com" { node 172.16.46.32 8080 } "siteex2.com" { node 172.16.40.253 8081 } "siteex3.com" { node 172.16.40.201 8082 } }}
- raj_Kumar_19166
Nimbostratus
Thanks Lee and Kevin for providing the information.
Lee all of the external sites work on the same IP (its only single VIP)
could you please confirm how we can make data group for this requirement.
we will use Source Address Translation:auto map and we will enable Address Translation/Port Translation both inside VIP.
or below irule(which you mentioned) will work without data group?
switch -glob [string tolower [HTTP::host]] {
"siteex1.com" { node 172.16.46.32 8080 } "siteex2.com" { node 172.16.40.253 8081 } "siteex3.com" { node 172.16.40.201 8082 }}
what is the best solution for this requirement please confirm.
- Lee_Payne_53457
Cirrostratus
My solution works without a datagroup, we've used datagroups in the past but only when we have a high volume of external to internal name mappings or where there was a lot of additions/deletions and we needed to do it quickly without altering the iRule.
- raj_Kumar_19166
Nimbostratus
Thanks Lee for the solution. Indeed, your solution will work.
what load balance method will be using in Pool?
when i will use your solution.
switch -glob [string tolower [HTTP::host]] {
"siteex1.com" { node 172.16.46.32 8080 } "siteex2.com" { node 172.16.40.253 8081 } "siteex3.com" { node 172.16.40.201 8082 }
then it need to use Pool or not? or directly i will create node? i have one more doubt if in future we want to add internal server to load balance(for site1in.com) then how we will add the server and how F5 will decide to balance load (if any load balance method please confirm)
- Kevin_Stewart
Employee
if in future we want to add internal server to load balance(for site1in.com) then how we will add the server and how F5 will decide to balance load (if any load balance method please confirm)
This is why you'd use a pool instead of a node. With a pool designation you can simply add members to the pool without modifying the iRule.
You also don't technically need the "-glob" option in the switch, since you're not searching for any wildcard values.
- raj_Kumar_19166
Nimbostratus
Thanks Kevin i got solution
Create a separate pool for each site
pool1 contains 172.16.46.32:8080 pool2 contains 172.16.40.253:8081 pool3 contains 172.16.40.201:8082 Create an iRule
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "site1ex.com" { pool pool1 HTTP::host "site1.com" } "site2ex.com" { pool pool2 HTTP::host "site2in.com" } "site3ex.com" { pool pool3 HTTP::host "site3in.com" } } }
its fine for me.
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