Skip to content

Haproxy Add one more x-forwardfor-for when add “option forwardfor” #44

@jagerzhang

Description

@jagerzhang

version 1.7.8
Host: 192.168.1.101
Haproxy configuration

global
    daemon
    maxconn 100000
    stats timeout 2m
    pidfile /tmp/http.pid

defaults
    timeout http-request 10s
    timeout server 120s 
    timeout client 20s 
    timeout connect 4s 
    timeout tunnel 30m
    retries 3
    balance roundrobin
    option abortonclose
    option forwardfor    # Forward X-Forwarded-For
    option redispatch

frontend http
    bind :80
    mode http
    default_backend  test_svr

backend test_svr
    mode http
    server 192.168.1.102:8080 192.168.1.102:8080

The request Header info:

GET /api HTTP/1.0
X-Forwarded-For: 192.168.1.10, 192.168.1.11  ---> from request  
Proxy-Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36 /2.2.1.8
Accept-Encoding: gzip
X-Forwarded-For: 192.168.1.101  ---> Haproxy Added.

Why there are two X-Forwarded-For ???

Why Haproxy added a new X-Forwarded-For but not append It's Host ipaddress to the exsit one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: works as designedThis issue stems from a misunderstanding of how HAProxy is supposed to work.type: bugThis issue describes a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions