Forum Discussion
Gregg_Hanold_01
Nimbostratus
Nov 23, 2014reverse proxy server for uri translation
I am new to F5 as reverse proxy server. I have a dns entry pointing to my f5 app.fdn.com. I need to have users that enter app.fqdn.com/app1 be directed to myserver1.com/app1 and users that enter app.fqdn.com/app2 be directed to myserver2.com/app2. It seems that iRules should be able to accomplish this. Any direction or support on how to implement this would be greatly appreciated.
e.g.
configuration [root@ve11a:Active:In Sync] config tmsh list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 3 } [root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { switch -glob [HTTP::uri] { "/app1*" { HTTP::header replace Host "myserver1.com" node 200.200.200.101 } "/app2*" { HTTP::header replace Host "myserver2.com" node 200.200.200.111 } default { do something } } } } trace [root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.24.1(36523) <-> 172.28.24.10(80) 1416753933.7140 (0.0017) C>S --------------------------------------------------------------- GET /app1/something HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: app.fdn.com --------------------------------------------------------------- New TCP connection 2: 200.200.200.11(36523) <-> 200.200.200.101(80) 1416753933.7156 (0.0003) C>S --------------------------------------------------------------- GET /app1/something HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: myserver1.com ---------------------------------------------------------------
4 Replies
- nitass_89166
Noctilucent
e.g.
configuration [root@ve11a:Active:In Sync] config tmsh list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 3 } [root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { switch -glob [HTTP::uri] { "/app1*" { HTTP::header replace Host "myserver1.com" node 200.200.200.101 } "/app2*" { HTTP::header replace Host "myserver2.com" node 200.200.200.111 } default { do something } } } } trace [root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.24.1(36523) <-> 172.28.24.10(80) 1416753933.7140 (0.0017) C>S --------------------------------------------------------------- GET /app1/something HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: app.fdn.com --------------------------------------------------------------- New TCP connection 2: 200.200.200.11(36523) <-> 200.200.200.101(80) 1416753933.7156 (0.0003) C>S --------------------------------------------------------------- GET /app1/something HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: myserver1.com ---------------------------------------------------------------- nitass_89166
Noctilucent
if server host name (e.g. myserver1.com) is embedded in response, you also have to rewrite it (e.g. irule, stream profile).
- nitass
Employee
e.g.
configuration [root@ve11a:Active:In Sync] config tmsh list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 3 } [root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { switch -glob [HTTP::uri] { "/app1*" { HTTP::header replace Host "myserver1.com" node 200.200.200.101 } "/app2*" { HTTP::header replace Host "myserver2.com" node 200.200.200.111 } default { do something } } } } trace [root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.24.1(36523) <-> 172.28.24.10(80) 1416753933.7140 (0.0017) C>S --------------------------------------------------------------- GET /app1/something HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: app.fdn.com --------------------------------------------------------------- New TCP connection 2: 200.200.200.11(36523) <-> 200.200.200.101(80) 1416753933.7156 (0.0003) C>S --------------------------------------------------------------- GET /app1/something HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: myserver1.com ---------------------------------------------------------------- nitass
Employee
if server host name (e.g. myserver1.com) is embedded in response, you also have to rewrite it (e.g. irule, stream profile).
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
