Welcome! Log In Create A New Profile

Advanced

client => connection close => proxy_pass => keepalive

Posted by nginxuser99 
client => connection close => proxy_pass => keepalive
May 18, 2015 11:48AM
Hi
nginx/1.8.0

I would like to be able to proxy http requests from a client via proxy_pass to upstream servers where the http connection from the client is closed and the http connection to the proxy_pass upstream is kept open. eg.

#close all client requests
keepalive_timeout 0;

upstream domain {
server domain.com;
keepalive 50;
}

server {
listen 8080;
server_name 127.0.0.1;
location /domain {
proxy_pass http://domain/req;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host domain.com;
#keep upstream connections open for 1 day
keepalive_timeout 86400s;
}
}

The intention is to keep 50 persistent connections to domain.com open for 1 day and close client connections to 127.0.0.1:8080/domain as and when the upstream returns a response. The result with keepalive_timeout 0; globally is that no upstream connections are re-used and with keepalive_timeout set to 86400s both client and upstream connections are kept established. Please help.

Regards
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready