Hello,
On 2025-09-11 20:35, Mike Casinghino wrote:
I am trying to configure relayd on 7.6 to forward http traffic to a
different port on 127.0.0.1 based on the Host header. For example, I
would like to do:
table <localhost> { 127.0.0.1 }
http protocol "https" {
tls { keypair "example.com" }
match request header "Host" value "app1.example.com" forward to
<localhost> port 9991
match request header "Host" value "app2.example.com" forward to
<localhost> port 9992
}
# Terminate tls and proxy
relay "tlsproxy" {
listen on egress port 443 tls
forward to 127.0.0.1 port 8000
protocol "https"
}
I am getting a syntax error on the match request lines because of the
port specification. As far as I can tell, the match rule doesn't
support a port number nor does the table definition. Any advice is
appreciated
I define different local services with different tables, and ports are
only defined in the relays like so:
table <httpd> { 127.0.0.1 }
table <soju_http> { 127.0.0.1 }
http protocol "https" {
return error
tls keypair "krkrkr.org"
match request header set "X-Forwarded-For" value "$REMOTE_ADDR"
match request header set "X-Forwarded-By" value
"$SERVER_ADDR:$SERVER_PORT"
match request url "irc.krkrkr.org/socket" tag "SOJU"
match request url "irc.krkrkr.org/uploads" tag "SOJU"
match request url "irc.krkrkr.org/uploads/" tag "SOJU"
http websockets
pass request tagged "SOJU" forward to <soju_http>
pass request header "Host" value "krkrkr.org" forward to <httpd>
}
relay "https" {
listen on 0.0.0.0 port 443 tls
protocol https
forward to <httpd> port 8080
forward to <soju_http> port 8888
}
relay "https6" {
listen on :: port 443 tls
protocol https
forward to <httpd> port 8080
forward to <soju_http> port 8888
}