Ip_hash and real_ip_header


I’ve got Nginx 0.7.64 running as a loadbalancer / transformation proxy
behind varnish. I’d like to use ip_hash so users get the benefit of
session affinity on my app servers. Though I seem to have
real_ip_header setup correctly ($remote_addr is correct as shown by
X-Real-IP on my app servers), all the requests end up using only a
single app server. Here’s the relevant parts of my config:

http {

real_ip_header X-Forwarded-For;

upstream backend {

Should this work?



Laurence Rowe wrote:

Should this work?

Should do AFAICT. Have you tried compiling with debug on - information
about IP addresses is given if you have debug_http set in the config

Have you tried round-robin to check that both servers work that way?

btw, if you don’t need to have a trace of all the IP addresses of the
servers, using X-Real-IP as the ‘real_ip_header’ is marginally quicker
than X-Forwarded-For.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs