Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to proxy from https to http with lighttpd

Tags:

proxy

lighttpd

I have this internal site (192.168.2.1) which is only accessible with http

On a different server I run a public web-server using lighttpd. I can make this internal site accessible to the outside work as follows

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

This works, but I would like to use https for the outside world. So my question is, how can I proxy this going from https to http ?

I've tried something like this:

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

But this doesn't seem to work. Any help would be appreciated

UPDATE: I get the impression that https is not supported in combination with reverse proxies. Maybe HAProxy is the solution

like image 472
Jeanluca Scaljeri Avatar asked Nov 28 '25 17:11

Jeanluca Scaljeri


1 Answers

lighttpd can listen to clients on https and proxy to a backend via http.

In your config example, is the external client sending requests to https://internal.example.com/... ? The authority (e.g. hostname) of the external URL is what needs to go into your $HTTP["host"] condition which enables the proxy.

$SERVER["socket"] == ":443" {
    $HTTP["host"] == "external.example.com" {
        ...
        proxy.server  = ( "" =>
            ( "internal" =>
                (
                    "host" => "192.168.2.1",
                    "port" => 8000
                )
            )
        )
    }
}
like image 126
gstrauss Avatar answered Dec 02 '25 05:12

gstrauss



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!