如何使用lighttpd从https代理到http

时间:2016-11-04 16:18:43

标签: proxy lighttpd

我有这个内部网站(192.168.2.1),只能通过http

访问

在另一台服务器上,我使用lighttpd运行公共Web服务器。我可以使这个内部网站可以访问外部工作,如下所示

$HTTP["host"] == "internal.example.com" {
    ...
    proxy.server  = ( "" =>
        ( "internal" =>
            (
                "host" => "192.168.2.1",
                "port" => 8000
            )
        )
}

这有效,但我想将https用于外界。所以我的问题是,如何将此代理从https代理到http

我尝试过这样的事情:

$SERVER["socket"] == ":443" {
   $HTTP["host"] == "internal.example.com" {
        ...
        proxy.server  = ( "" =>
            ( "internal" =>
                (
                    "host" => "http://192.168.2.1",
                    "port" => 8000
                )
            )
    }
}

但这似乎不起作用。任何帮助将不胜感激

更新:我得到的结论是,反向代理不支持https。也许HAProxy是解决方案

1 个答案:

答案 0 :(得分:1)

lighttpd可以通过http收听https上的客户端并代理到后端。

在您的配置示例中,外部客户端是否向https://internal.example.com/发送请求...?外部URL的权限(例如主机名)是需要进入启用代理的$ HTTP [" host"]条件的权限。

$SERVER["socket"] == ":443" {
    $HTTP["host"] == "external.example.com" {
        ...
        proxy.server  = ( "" =>
            ( "internal" =>
                (
                    "host" => "192.168.2.1",
                    "port" => 8000
                )
            )
        )
    }
}
相关问题