为特定请求模式配置 Nginx 连接超时
Configure Nginx connection timeout for specific request pattern
在应用程序中,我想增加连接超时,因为它具有上传大文件的功能。目前我找到了下一个属性:
proxy_connect_timeout 20;
proxy_send_timeout 20;
proxy_read_timeout 20;
但问题是我希望不允许通过所有端点进行如此长的连接,而只允许特定一个端点连接。
有什么方法可以为特定的请求模式配置 Nginx "connection timeout"?
是的! nginx 的优点之一是您可以根据位置、路径、参数、源 IP 地址……基本上在任何元数据上设置层次结构中的值。
server {
listen 443 ssl http2;
....
# default timeouts here
proxy_connect_timeout <smallval>;
proxy_send_timeout <smallval>;
proxy_read_timeout <smallval>;
location /biguploadshere {
proxy_connect_timeout <bigval>;
proxy_send_timeout <bigval>;
proxy_read_timeout <bigval>;
}
}
在应用程序中,我想增加连接超时,因为它具有上传大文件的功能。目前我找到了下一个属性:
proxy_connect_timeout 20;
proxy_send_timeout 20;
proxy_read_timeout 20;
但问题是我希望不允许通过所有端点进行如此长的连接,而只允许特定一个端点连接。
有什么方法可以为特定的请求模式配置 Nginx "connection timeout"?
是的! nginx 的优点之一是您可以根据位置、路径、参数、源 IP 地址……基本上在任何元数据上设置层次结构中的值。
server {
listen 443 ssl http2;
....
# default timeouts here
proxy_connect_timeout <smallval>;
proxy_send_timeout <smallval>;
proxy_read_timeout <smallval>;
location /biguploadshere {
proxy_connect_timeout <bigval>;
proxy_send_timeout <bigval>;
proxy_read_timeout <bigval>;
}
}