azure - HAProxy 中的 Proxy_pass 等效项

标签 azure nginx haproxy

HAProxy 中的 Nginx pass_proxy 相当于什么

location /{
    proxy_pass https://WebApplication.azurewebsites.net;
  }

我尝试测试此配置,但当我指向具有以下配置的任何后端服务器时,如果没有在根目录上使用 ACL(例如使用自签名证书),我会收到 404

    #---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    log /dev/log    local0
    log /dev/log    local1 notice
    user haproxy
    group haproxy
    maxconn  16000
    stats  socket /var/lib/haproxy/stats level admin
    tune.bufsize  32768
    tune.maxrewrite  1024
    tune.ssl.default-dh-param 2048
    daemon 
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
   log global
   mode http
   option httplog
   option dontlognull
   timeout connect 5000
   timeout client 50000
   timeout server 50000 
#---------------------------------------------------------------------
#HAProxy Monitoring Config
#---------------------------------------------------------------------
log global
   mode http
   option httplog
   option dontlognull
   timeout connect 5000
   timeout client 50000
   timeout server 50000
#---------------------------------------------------------------------
# FrontEnd Configuration
#---------------------------------------------------------------------
frontend fe_http_sne_in
bind *:443 ssl crt /etc/ssl/private/mydomain.pem
option forwardfor
default_backend be_default

backend be_default
mode http 
option forwardfor
http-request add-header X-Forwarded-For %[src]
server srv02 www.google.com:443 ssl verify none

当我指向使用 bing、google 作为 url 测试的任何后端服务器时,我收到 404 ...

enter image description here

最佳答案

我建议使用以下配置

frontend fe_http_sne_in
bind *:443 ssl crt /etc/ssl/private/mydomain.pem
option forwardfor
use_backend be_sne_insecure if { path_beg /test}
default_backend be_default

backend be_default
...

backend be_sne_insecure
mode http 
option forwardfor
http-request replace-header Host .* WebApplication.azurewebsites.net 
server srv01 WebApplication.azurewebsites.net:443 ssl verify none

在博客文章中Introduction to HAProxy ACLs acl 解释了吗

关于azure - HAProxy 中的 Proxy_pass 等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57142878/

相关文章:

powershell - Azure Powershell - 如何获取资源状态

Azure Functions 方法未找到错误

使用旧版本的 NPM 运行的 azure 应用程序服务

tomcat - 客户端证书从haproxy转发到tomcat

linux - haproxy重启时出错

azure - 如何使用状态集 kubernetes 将 cassandra 数据位置安装到 azure 文件共享

nginx - Nginx 可以使用 SSL 终止进行 TCP 负载平衡吗?

php - Nginx 仅在 php 脚本和子域上抛出 404 错误

openid - 使用 openid 作为静态内容身份验证的最简单方法

ubuntu - Haproxy 1.4 连接到 https 后端服务器