duangu1033 2016-10-17 06:51
浏览 80

haproxy服务器变量未被传递

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
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!