I have an haproxy lb running locally with nginx, and about 30% of the time the server name is not being picked up by my php application (I see a lot of Undefined variable: _SERVER
) in the logs. I've gone through PHP and NGINX conf, but still can't figure this one out, so asking the pros.
I've tried adding header information, forward, etc, but still this error remains. Has anyone seen it, or knows the solution? I just can't solve it.
The pertinent part of my HAPROXY,
default
option forwardfor
option prefer-last-server
option http-server-close
no option http-keep-alive
no option checkcache
timeout http-keep-alive 15s
timeout http-request 15s
timeout tarpit 60s
backend
http-send-name-header Host
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header X-Custom-Header %[url]
http-response set-header X-Server-Name %s
http-response set-header X-Server-IP %si
acl set_cookie_len res.hdr(Set-Cookie) -m len 0
rspidel Set-Cookie if set_cookie_len
#
cookie SRV_ID insert indirect nocache maxidle 30m maxlife 8h