Welcome! Log In Create A New Profile

Advanced

Nginx as forward proxy and maintaining persistent connections

March 23, 2018 08:17PM
am trying to configure nginx as a forward proxy and establish persistent connection between the nginx and the upstream server. When I set

server {
location / {
proxy_pass http://$http_host$request_uri;
proxy_http_version 1.1;
proxy_set_header Connection "";
...
}
}
in the location context, it has no effect until I have a upstream module that has keepalive directive in it. Is it mandatory to specify the upstream module with keepalive directive? If I do that way,

http
{
upstream up {
server $http_host;
keepalive 20;
}
server {
proxy_pass http://up$request_uri;
}
}
I get the error host not found in upstream "$http_host". Looks like the server directive is not using it as variable but merely looking for a server named $http_host? I tried finding hints in online resources but couldn't get help. I need someone to point me how this goes wrong?
Subject Author Posted

Nginx as forward proxy and maintaining persistent connections

vi54 March 23, 2018 08:17PM

Re: Nginx as forward proxy and maintaining persistent connections

Maxim Dounin March 24, 2018 11:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready