我们在所有应用程序之前都有一个HAProxy . 它将所有http流量重定向到https,管理ssl并进行一些重写,将请求分割为 /*/api/* 到不同的后端 .

一个后端处理可以运行最多3分钟的请求 . 此请求可以经常被触发,但也会经常被取消:
enter image description here

为减少负载,后端服务器处理已取消的请求并停止工作 . 但是在HAProxy之间,我的后端服务器无法识别已取消的请求 . 我认为 option abortonclose 将是我正在寻找的选项,但它不能按预期工作 .

这是我们配置的片段

...

defaults
    log      global
    mode     http
    option   redispatch
    option   tcplog
    option   dontlognull
    option   abortonclose
    retries  3
    timeout  http-request 10s
    timeout  queue 1m
    timeout  connect 10s
    timeout  client 1m
    timeout  server 1m
    timeout  check 10s

...

listen redirect-http-proxy
    bind xxx.xxx.xxx.xxx:80
    acl http ssl_fc,not
    http-request redirect scheme https if http

frontend proxy_ssl
    bind xxx.xxx.xxx.xxx:443 ssl crt /etc/ssl/private/xxx.pem
    option tcpka
    #map-file
    use_backend %[base,lower,map_beg(/etc/haproxy/xxx.map,bk_default)]

...

backend my-backend-name
     balance roundrobin
     option  tcp-check
     server my-server xxx.xxx.xxx.xxx:12345/api check port 12345 inter 5000 rise 2 fall 5