Forum Discussion
DM_5174
Nimbostratus
Nov 02, 2011Redirect to another POOL with URI and port
Hi All,
I was wondering if there is a way to redirect a URI to POOL and keeping
the URI? Below are the irule to send to the pool, however, I could not figure out
or know if there is a way to keep the uri also when sending to this pool...Example of what is needed:
1. external users goes to http://www.mydomain.com/soap/newapp1
2. based on matching the URI "/soap/newapp1", they are forwarded to a member in the SOAP_POOL that is listening on port 8080, however during this, the URI needs to match "http://192.168.2.100:8080/soap/newapp1".NOTE: We do not want to redirect from one link to another since this server is internal and not accessible to internet clients. So, if I was an external users and i enter
"http://www.mydomain.com/soap/newapp1", I SHOULD not get redirected to
"http://192.168.2.100/soap/newapp1" because they will not be able to access the
internal IP of the web server.POOL: SOAP_POOL
Member: 192.168.2.100:8080
when HTTP_REQUEST {
if {[HTTP::uri] equals {"/soap/newapp1/"}}
{
pool SOAP_POOL
}
switch -glob [string tolower [HTTP::uri]] {
"/app1*" -
"/app2*" -
"/app3*" -
"/app4*" -
{
pool APACHE_SERVER_POOL }
default {
pool IIS_WEB_POOL
}
}
}-DM
7 Replies
- nitass
Employee
does pool member really expect 192.168.2.100:8080 host header?
this is mine. both are working fine.1 [root@iris:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.17.33:http ip protocol tcp profiles { http {} tcp {} } } [root@iris:Active] config b pool foo list pool foo { members 10.10.70.110:webcache {} } [root@iris:Active] config ssldump -Aed -nni 0.0 port 80 or port 8080 New TCP connection 1: 172.28.17.20(56735) <-> 172.28.17.33(80) 1320253103.1999 (0.0009) C>S --------------------------------------------------------------- GET /soap/newapp1 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www.mydomain.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 10.10.72.30(56735) <-> 10.10.70.110(8080) 1320253103.2002 (0.0003) C>S --------------------------------------------------------------- GET /soap/newapp1 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www.mydomain.com Accept: */* 2 [root@iris:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.17.33:http ip protocol tcp rules myrule profiles { http {} tcp {} } } [root@iris:Active] config b pool foo list pool foo { members 10.10.70.110:webcache {} } [root@iris:Active] config b rule myrule list rule myrule { when HTTP_REQUEST_SEND { clientside { HTTP::header replace Host [LB::server addr]:[LB::server port] } } } [root@iris:Active] config ssldump -Aed -nni 0.0 port 80 or port 8080 New TCP connection 1: 172.28.17.20(33195) <-> 172.28.17.33(80) 1320253325.7189 (0.0007) C>S --------------------------------------------------------------- GET /soap/newapp1 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www.mydomain.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 10.10.72.30(33195) <-> 10.10.70.110(8080) 1320253325.7194 (0.0004) C>S --------------------------------------------------------------- GET /soap/newapp1 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 10.10.70.110:8080 Accept: */* - DM_5174
Nimbostratus
not exactly, the external users should not see or get redirected to the 192.168.2.100 address since this is an internal non-routable IP.
what should happen is based on matching the URI "/soap/newapp1", they should be sent/forwarded to the "SOAP_POOL" that has a member 192.168.2.100 listening on port 8080. The URI path should carry to this fowarding "http://[member of pool:8080]/soap/newapp1.
-DM - DM_5174
Nimbostratus
not exactly, the external users should not see or get redirected to the 192.168.2.100 address since this is an internal non-routable IP.
what should happen is based on matching the URI "/soap/newapp1", they should be sent/forwarded to the "SOAP_POOL" that has a member 192.168.2.100 listening on port 8080. The URI path should carry to this fowarding "http://[member of pool:8080]/soap/newapp1.
-DM - DM_5174
Nimbostratus
Can any help or even know this is even possible? I have been digging through the past forum and have not seen any thread of this ever being done, or even possible to do...
Please help.
Thanks,
DM - Michael_Yates
Nimbostratus
Hi DM,
Check the Virtual Server and insure that "Address Translation" and "Port Translation" are enabled. They should be enabled by default.
If so, the LTM will do all of the Port Translation in the background (no need to append any ":8080" in the request) and the Address Translation from the Virtual Server IP Address to the Pool Server IP Address.
This should do what you are asking:when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/soap/newapp1*" { pool SOAP_POOL } "/app1*" - "/app2*" - "/app3*" - "/app4*" { pool APACHE_SERVER_POOL } } default { pool IIS_WEB_POOL } }
Hope this helps. - DM_5174
Nimbostratus
You are the man Michael...that did it!!!
Thank you so much!
-DM - Michael_Yates
Nimbostratus
Thanks. Glad I could help. :-)
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
