Forum Discussion
Redirect connection to a pool member based on http code
Hi ShibuNair,
Without knowing anything else about your configuration, it sounds like you would be better served with a monitor attached to your pool instead of using an iRule. Health monitors check the availability of a pool member.
First, I would look at creating a monitor of type PostgreSQL. That will actually query the database and may be more helpful in determining availability.
Second, if a connection to your PostgreSQL server actually does return an HTTP response code, I would look at creating a monitor of type HTTP (or HTTPS) for your pool. You can use regex in the Receive String, something like '^HTTP\/1.(0|1)\s200' to ensure only a response of 200 is considered "available".
Finally, if you are truly set on using an iRule, the iRule will need to send a request to your PostgreSQL server in order to get a response to inspect. You could use the "scan" command to inspect the HTTP response. Here is a good example: https://devcentral.f5.com/questions/choose-pool-based-on-http-response-54401
Hope this helps.
You do not necessarily need to configure two health monitors. You need to determine what is the best indicator of availability for your environment. If an HTTP response code of 200 is the best indicator for you, then you only need the HTTP/HTTPS health monitor. In that case, you are correct in that the other server would be marked as unavailable by the BIG-IP because it does not respond with the 200 code.
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