Limit simultaneous connections in proxy_pass

47 views
Skip to first unread message

Roney Rogério

unread,
Aug 17, 2016, 9:38:19 PM8/17/16
to openresty-en
I met these wonderful tools are nginx and openresty 2 days ago, I am finding amazing.
But I need a free solution for this feature present only in nginx plus it costs a small fortune.
In server parameters of ngx_http_upstream_module have parameter max_conns
 In the example below I want to limit access to
example.com to 10 simultaneous connections at most.

upstream server {
   server example
.com max_conns=10;
}

location
/folder/ {
     proxy_pass http
://server;
}




But free nginx dont have
max_conns, is there any way to do this with openresty, or some other solution that I still do not know?

Peter Booth

unread,
Aug 18, 2016, 12:18:00 AM8/18/16
to openre...@googlegroups.com
Roney,

I'm sure this can be hacked together one way or another. 

Some questions that could have a bearing on the answer to your question:

1. What kind of upstream requests are you sending? POSTs or GETs?

2. Are the results cache able?

3. Imagine that you have this feature and right now you have ten upstream connections in use. If you receive another request that needs an upstream connection, do you want to return a 502 Bad Gateway error? (This is the standard behavior) Or do you want the request to be queued ?

Peter

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roney Rogério

unread,
Aug 18, 2016, 12:53:50 AM8/18/16
to openresty-en
1. Get
2. Cache enabled
3. Whitout error message

Thanks.
Reply all
Reply to author
Forward
0 new messages