我试图在haproxy中为我的java Rest Services传递基于user_id的动态值 .

本地主机:/ AAA / BBB / {用户ID}

以下声明是示例

本地主机:/ AAA / BBB / 1

本地主机:/ AAA / BBB / 2

本地主机:/ AAA / BBB / 3

我想通过haproxy传递它 . 我有以下配置..

global
    log /dev/log    local0
    log /dev/log    local1 notice
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

    # Default SSL material locations
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private

    # Default ciphers to use on SSL-enabled listening sockets.
    # For more information, see ciphers(1SSL).
    ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4- SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL

默认

log     global
     mode    http
     option  httplog
     option  dontlognull
     timeout connect 5000
     timeout client  50000
    timeout server  50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

前端http

bind *:80    
acl msg-listing-read path_end -i /AAA/BBB/{user_id}
use_backend ppl-be-msg-listing-read-dev if msg-listing-read

后端ppl-be-msg-listing-read-dev

balance roundrobin
server ppl-msg-listing-read-dev localhost:8080 maxconn 32 check

听统计

bind 0.0.0.0:81
stats enable
stats uri /

任何想法将不胜感激,并在此先感谢 .