AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1094044
Accepted
Paolo Benvenuto
Paolo Benvenuto
Asked: 2022-02-18 19:05:40 +0800 CST2022-02-18 19:05:40 +0800 CST 2022-02-18 19:05:40 +0800 CST

升级到 2.2 版时 haproxy 不工作(reqadd 不再存在)

  • 772

[我错误地在stackoverflow上发布了这个问题]

在我的 debian buster 服务器上,我有一个完美运行的 haproxy (v1.8),我用它来管理我的网站的证书。

haproxy 监听 443 端口,并将请求传递给 varnish+apache 系统。

升级到 debian Bullseye 时,haproxy (v2.2) 服务不再启动,并且日志显示:

haproxy[46308]: [ALERT] 048/004148 (46308) : parsing [/etc/haproxy/haproxy.cfg:46] : The 'reqadd' directive is not supported anymore since HAProxy 2.1. Use 'http-r
equest add-header' instead.

负责此行为的 haproxy.cfg 行是

frontend https
# Bind 443 with the generated letsencrypt cert.
        bind *:443 ssl crt /etc/letsencrypt/live/qumran2/haproxy.pem
        # set x-forward to https
        reqadd X-Forwarded-Proto:\ https                  <-----------|
        # set X-SSL in case of ssl_fc <- explained below
        http-request set-header X-SSL %[ssl_fc]
        # Select a Challenge
        acl letsencrypt-acl path_beg /.well-known/acme-challenge/
        # Use the challenge backend if the challenge is set
        default_backend www-backend

我知道我必须换reqadd X-Forwarded-Proto:\ https行,但是怎么做?

文档说:

http-request add-header <name> <fmt> [ { if | unless } <condition> ]
This appends an HTTP header field whose name is specified in <name> and
whose value is defined by <fmt> which follows the log-format rules (see
Custom Log Format in section 8.2.4). This is particularly useful to pass
connection-specific information to the server (e.g. the client's SSL
certificate), or to combine several headers into one. This rule is not
final, so it is possible to add other similar rules. Note that header
addition is performed immediately, so one rule might reuse the resulting
header from a previous rule.

我不明白我应该如何写等价的http-request add-header......

https haproxy
  • 1 1 个回答
  • 820 Views

1 个回答

  • Voted
  1. Best Answer
    Malcolm turnbull
    2022-02-18T23:40:04+08:002022-02-18T23:40:04+08:00

    我认为您可以使用:

    http-request set-header X-Forwarded-Proto https
    

    正如这里所讨论的:

    https://stackoverflow.com/questions/51928504/x-forwarded-proto-https-in-frontend-or-backend-haproxy

    • 0

相关问题

  • 为 IIS 7.0 问题创建证书

  • IE6 和更高版本在 HTTPS 处理方面的差异

  • 如何模拟连接到 HTTPS 并记录握手?

  • SSL 错误:ssl_error_bad_mac_read

  • 在实时站点上使用自签名证书有什么好处?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve