# irule to respond custom http code when all of the pool members reach their connection limit

**URL:** <https://community.f5.com/t/irule-to-respond-custom-http-code-when-all-of-the-pool-members-reach-their-connection-limit/76390>\
**Category:** Technical Forums\
**Tags:** application-delivery\
**Created:** [July 28, 2025, 7:18pm UTC](https://community.f5.com/t/irule-to-respond-custom-http-code-when-all-of-the-pool-members-reach-their-connection-limit/76390 "2025-07-28T19:18:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oguzhan\_K](https://avatars.discourse-cdn.com/v4/letter/o/ecd19e/32.png) [@Oguzhan\_K](https://community.f5.com/u/Oguzhan_K)\
**Post date:** [July 28, 2025, 7:18pm UTC](https://community.f5.com/t/irule-to-respond-custom-http-code-when-all-of-the-pool-members-reach-their-connection-limit/76390/1 "2025-07-28T19:18:25Z")

</div>

Hello,

We have a Virtual Server that is heavily used by clients. (There are approximately 180,000 to 250,000 active connections at all times.)

We load balance six servers on this Virtual Server, and a connection limit is applied to them.

We wanted to create an irule that would return special HTTP codes (like HTTP 429) to clients when all members in the pool reached their connection limit.

We generated it via the LB\_FAILED event, but this didn’t work as expected. We responded to some clients with special HTTP codes, even though the servers weren’t within their limit.

We’re currently testing LB\_QUEUED, but we’re not sure if it will work.

Do you have any suggestions?

Thanks

---

<div class="post-metadata">

**Author:** ![Teerarat](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/teerarat/32/4921_2.png) [@Teerarat](https://community.f5.com/u/Teerarat)\
**Post date:** [July 31, 2025, 5:15am UTC](https://community.f5.com/t/irule-to-respond-custom-http-code-when-all-of-the-pool-members-reach-their-connection-limit/76390/2 "2025-07-31T05:15:58Z")

</div>

Hi

Can you try irules below,

when HTTP\_REQUEST {  
&nbsp; &nbsp; if { [active\_members [LB::server pool]] == 0 } {  
&nbsp; &nbsp; &nbsp; &nbsp; HTTP::respond 200 content “\<html\>\<head\>\<title\>Service Unavailable\</title\>\</head\>\<body\>\<h1\>Sorry, our service is temporarily unavailable. Please try again later.\</h1\>\</body\>\</html\>”  
&nbsp; &nbsp; }  
}
