Forum Discussion
Poll with range of ports
Dear all,
I actually have a VS exposing some web services on https. The services are internally delivered from the same server on different ports, at the moment 11 ports from 8900 to 8910. The request is made like this: https://<my hostname>/<port>/<company>/<service uri>. To make it working I've created 11 different pool with same general suffix followed by the port number and wrote this iRule:
when HTTP_REQUEST {
if { [HTTP::host] equals "<my hostname>" } {
if { [HTTP::uri] matches_regex {/89[0-1][0-9]/} } {
set port [lindex [split [HTTP::uri] "/"] 1]
set company [lindex [split [HTTP::uri] "/"] 2]
set new_uri [string map -nocase [list $port/ ""] [HTTP::uri]]
switch -glob -- [URI::decode [HTTP::uri]] "
/$port/$company/* {HTTP::uri $new_uri
pool <common pool name>_$port}"
} else {
HTTP::respond 403 content {<html>Accesso Negato</html>}
}
}
}
Basically it checks if the hostname is correct and the request contains the range of port, then it takes the port number and company name rewrite the uri and choose the correct pool. Now the develompment team wants to extend the services from port 8900 to 8999. I'd like to avoid to create 100 different pools, is there a way to make this in a simpler manner?
Thank you in advance
Luca
- Luca_Comes
Cirrus
Sorry I make a mistake on the title...I was meaning Pool with range of ports
- David_M
Cirrostratus
Can you add more details on what is going on here..this is interesting. .100 servers! haha.
What application is this, sounds like oracle something.
Maybe you can try this with ltm policy? It has lot of simple gui config compared to writing irules.
- Luca_Comes
Cirrus
Hi David thank you for your answer. I have not more informations on the application, I know only it is a webservice that is exposed on different ports in function of the customer who need to use the service, so many customers and many ports. My problem is not to write the iRule, I have done it dynamically with variables my problem as you can imagine is to create 100 different pools. I was thinking if there is a way to create a pool with the same pool member but a range of ports.
Luca
- David_M
Cirrostratus
Well you can just leave the pool member ports to ALL SERVICES.
And create an irule which will only allow connections to your allowed range of ports and reject everything else.
- Luca_Comes
Cirrus
Ok, I wil give it a try even if I have to understand on how to make the correct request to the pool member when different port are specified in the uri request over https.
Many Thanks
Luca
- David_M
Cirrostratus
Its just 1 server listening on multiple ports right?
So whatever the uri and ports comes in should be responded to by the member as the services are set to all .
- Luca_Comes
Cirrus
Yes it is but the client request is not made host:port/uri instead the request is done with host/customer_name/service. At the moment only some services are configured so I created some different pools with the same pool member and different port (one for each pool). I then export the customer from URI and make the right pool decision on that information. I thnk ther isn't a manner to accomplish this with a unique pool.
Luca
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