mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-08 10:45:04 +02:00
Set default IMGPROXY_MAX_CLIENTS value to 2048; Allow unlimited connections
This commit is contained in:
parent
d610afb48b
commit
bb3a9c77f7
@ -186,7 +186,7 @@ func Reset() {
|
||||
KeepAliveTimeout = 10
|
||||
DownloadTimeout = 5
|
||||
Concurrency = runtime.NumCPU() * 2
|
||||
MaxClients = 0
|
||||
MaxClients = 2048
|
||||
|
||||
TTL = 3600
|
||||
CacheControlPassthrough = false
|
||||
@ -534,8 +534,8 @@ func Configure() error {
|
||||
return fmt.Errorf("Concurrency should be greater than 0, now - %d\n", Concurrency)
|
||||
}
|
||||
|
||||
if MaxClients <= 0 {
|
||||
MaxClients = Concurrency * 10
|
||||
if MaxClients < 0 {
|
||||
return fmt.Errorf("Concurrency should be greater than or equal 0, now - %d\n", MaxClients)
|
||||
}
|
||||
|
||||
if TTL <= 0 {
|
||||
|
@ -33,7 +33,7 @@ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
||||
* `IMGPROXY_KEEP_ALIVE_TIMEOUT`: the maximum duration (in seconds) to wait for the next request before closing the connection. When set to `0`, keep-alive is disabled. Default: `10`
|
||||
* `IMGPROXY_DOWNLOAD_TIMEOUT`: the maximum duration (in seconds) for downloading the source image. Default: `5`
|
||||
* `IMGPROXY_CONCURRENCY`: the maximum number of image requests to be processed simultaneously. Default: the number of CPU cores multiplied by two
|
||||
* `IMGPROXY_MAX_CLIENTS`: the maximum number of simultaneous active connections. Default: `IMGPROXY_CONCURRENCY * 10`
|
||||
* `IMGPROXY_MAX_CLIENTS`: the maximum number of simultaneous active connections. When set to `0`, connections number limitation is disabled. Default: `2048`
|
||||
* `IMGPROXY_TTL`: a duration (in seconds) sent via the `Expires` and `Cache-Control: max-age` HTTP headers. Default: `3600` (1 hour)
|
||||
* `IMGPROXY_CACHE_CONTROL_PASSTHROUGH`: when `true` and the source image response contains the `Expires` or `Cache-Control` headers, reuse those headers. Default: false
|
||||
* `IMGPROXY_SET_CANONICAL_HEADER`: when `true` and the source image has an `http` or `https` scheme, set a `rel="canonical"` HTTP header to the value of the source image URL. More details [here](https://developers.google.com/search/docs/advanced/crawling/consolidate-duplicate-urls#rel-canonical-header-method). Default: `false`
|
||||
|
@ -45,7 +45,10 @@ func startServer(cancel context.CancelFunc) (*http.Server, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Can't start server: %s", err)
|
||||
}
|
||||
l = netutil.LimitListener(l, config.MaxClients)
|
||||
|
||||
if config.MaxClients > 0 {
|
||||
l = netutil.LimitListener(l, config.MaxClients)
|
||||
}
|
||||
|
||||
s := &http.Server{
|
||||
Handler: buildRouter(),
|
||||
|
Loading…
Reference in New Issue
Block a user