(:redirect Relayd.Acceleration:) Suppose you want to have relayd act as a reverse proxy for two different domains served on separate ports. In this case, suppose both www.ircnow.org and bnc.ircnow.org need relayd to provide TLS acceleration, but run on separate ports (1338 and 8080). ## Howto You need to edit _/etc/relayd.conf_ with the following contents. Alternatively, you can copy a sample config file from _/etc/examples/relayd.conf_ and adjust it to your needs. ip4="192.168.1.1" ip6="2001:db8::" webhost="127.0.0.1" table { $webhost } table { $webhost } http protocol https { match request header append "X-Forwarded-For" value "$REMOTE_ADDR" match request header append "X-Forwarded-By" \ value "$SERVER_ADDR:$SERVER_PORT" match request header set "Connection" value "close" # Various TCP options tcp { sack, backlog 128 } # tls { no tlsv1.0, ciphers HIGH } # tls no session tickets match request header "Host" value "bnc.ircnow.org" forward to match request header "Host" value "www.ircnow.org" forward to } relay wwwtls { # Run as a SSL/TLS accelerator listen on $ip4 port 443 tls listen on $ip6 port 443 tls protocol https # Forward to hosts in the table forward to port 1338 mode loadbalance check icmp forward to port 8080 mode loadbalance check icmp } You'll need corresponding TLS certs: # ln -s /etc/ssl/example.com.fullchain.pem /etc/ssl/192.168.1.1:443.crt # ln -s /etc/ssl/example.com.fullchain.pem /etc/ssl/2001:db8::.crt # ln -s /etc/ssl/private/example.com.key /etc/ssl/private/192.168.1.1:443.key # ln -s /etc/ssl/private/example.com.key /etc/ssl/private/2001:db8::.key # rcctl enable relayd # rcctl start relayd **WARNING**: Do not have httpd listen on port 443, or else the reverse proxy will fail to forward based on hostname for android and iOS devices! **WARNING**: Make sure that packet filter is enabled# relayd will not run if pf is disabled. If your httpd is listening on port 443 with TLS, adjust it to another port and without tls. In the prior example where __ is to be redirected to port 8080, you should have it set to something like _listen on 192.168.1.1 port 8080_ instead, in your _/etc/httpd.conf_. Make sure to also reload/restart your httpd once you made adjustments. You can alternatively check to ensure your config file does not contain error prior to reloading/restarting. To do that, you can do, # httpd -nf /etc/httpd.conf ## Troubleshooting ### relayd fails to start If for whatever reason you fail to start relayd, you can troubleshoot it via making it perform a config test: # relayd -n If it does not show _configuration OK_, it will typically indicate which line(s) containing error(s). ### relayd doesn't show verbose information According to [man 5 relayd.conf](/https://man.openbsd.org/relayd.conf.5), you can add in the following close towards the top of your _/etc/relayd.conf_, log connection Then reload/restart your relayd. **WARNING**: This may produce a verbose output which can dramatically increase the size of your _/var/log/daemon_, especially on busy networks. To avoid this, simply have your _syslogd_ send all relayd messages into its own file. To that, see [here](/http://openbsd-archive.7691.n7.nabble.com/relayd-log-file-td76656.html). In addition to splitting relayd logs to its own file, you may wish to create a new entry in your _/etc/newsyslog.conf_ to handle log rotation for your relayd. ### common errors # Make sure httpd is not also listening on port 443 # Make sure both www.ircnow.org and bnc.ircnow.org have real dns records # Make sure nsd is set up properly # Make sure znc is listening on port 1338 # Make sure packet filter is turned on