ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

haproxy 2.6 发布

2022-06-04 14:35:07  阅读:292  来源: 互联网

标签:haproxy stats log timeout 发布 https http 2.6


haproxy 2.6 发布了,提供了不少特性,其中quic (http3) 是可以直接使用了(注意依赖openssl 版本)我已经构建一个版本

http3 参考使用

  • docker 镜像
dalongrong/haproxy:2.6-debian-quic
  • 使用
    可以直接参考官方示例
 
#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   https://www.haproxy.org/download/2.6/doc/configuration.txt
#   https://cbonte.github.io/haproxy-dconv/2.6/configuration.html
#
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    log         127.0.0.1 local2
 
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    # daemon
 
    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats
 
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000
 
resolvers mynameservers
   nameserver ns1 127.0.0.11:53
 
frontend mysite
  bind :80
  bind :443  ssl crt /etc/haproxy/certs/dalong.com/cert.crt alpn h2
 
  # enables HTTP/3 over QUIC
  bind quic4@:443 ssl crt /etc/haproxy/certs/dalong.com/cert.crt alpn h3
 
  # Redirects to HTTPS
  http-request redirect scheme https unless { ssl_fc }
 
  # Switches to the QUIC protocol
  http-response set-header alt-svc "h3=\":443\";ma=2592000;"
 
  default_backend webservers
 
backend webservers
  balance roundrobin
  server web1 app:80 check maxconn 30 resolvers mynameservers
 
frontend stats
    bind *:8404
    stats enable
    stats uri /stats
    http-request use-service prometheus-exporter if { path /metrics }
    stats refresh 10s
    stats admin if LOCALHOST
 

参考效果

 

 

说明

quic 协议是很复杂的,http3 稳定以及可以大规模应用还是需要一段时间的

参考资料

https://www.haproxy.com/blog/announcing-haproxy-2-6/
https://http3-explained.haxx.se/en/why-quic
https://github.com/rongfengliang/haproxy-quic
https://github.com/haproxytechblog/haproxy-2.6-http3
https://http3check.net/

标签:haproxy,stats,log,timeout,发布,https,http,2.6
来源: https://www.cnblogs.com/rongfengliang/p/16341810.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有