Hi folks!,

I have a question about how to convert my current setup with nginx +
fastcgi to OpenBSD httpd + slowcgi and relayd.

The setup is pretty simple, I have the follow subdomains:

www.mydomain.org     - OpenBSD httpd, static pages.
git.mydomain.org     - OpenBSD httpd, slowcgi and cgit.
someapp.mydomain.org - custom httpd application (written in Golang),
listens on a UNIX domain socket or localhost port.

I have www and git successfully working with OpenBSD httpd, cgit and
git-daemon, it works very well and was simple to setup.

Now I want to also relay someapp.mydomain.org to the local Golang
httpd, the other HTTP traffic can go to the OpenBSD httpd, this is all
running on the same server. With nginx this was possible by using
nginx "proxy_pass"[0], like:

    server {
        listen 80;
        server_name someapp.mydomain.org;

        location / {
            proxy_pass
"http://unix:/domains/someapp.mydomain.org/someapp.sock:/";;
        }
    }

    server {
        listen 80;
        server_name www.mydomain.org;
        root /var/www/domains/www.mydomain.org/htdocs;
    }

I've tried to put relayd (port 80) as a reverse-proxy in front of
httpd and relay based on the HTTP "Host" header. It seems to me from
reading the documentation
that relayd can relay to one host or table per protocol, but not relay
to different ports on the same machine, but hopefully I'm totally
wrong.

My /etc/relayd.conf looked something like this:

    table <service> { 127.0.0.1 }

    http protocol "protmyapp" {
            return error

        # TODO: forward non-matching traffic to standard httpd.
            match request header "Host" value "someapp.mydomain.*"
    }

    relay "myapp" {
            listen on 0.0.0.0 port 80
            protocol "protmyapp"
            forward to <service> port 8081
    }

Does anyone have a similar setup and can help me with this?

Kind regards,
Hiltjo

[0] - http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

Reply via email to