relayd configuration

I found this question in a google search that nobody replied to, but am wondering if anyone knows if this now works, or what the answer may be to relay traffic to multiple servers.

This was my reason for only using relayd to redirect tcp traffice to nginx, but if this works, then I'll drop nginx altogether.

Code:
ext_addr="10.200.1.2" 

host1="192.168.4.10" 
host2="192.168.4.24" 

table <table_one>   { $host1 } 
table <table_two> { $host2 } 

http protocol "one_web" { 
   request header expect "one.domain.tld" from "Host" 

} 

http protocol "two_web" { 
   request header expect "two.domain.tld" from "Host" 

} 

relay relay_one { 
   listen on $ext_addr port http 
   protocol "onw_web" 
   forward to <table_one> check tcp 

} 

relay relay_two { 
   listen on $ext_addr port http 
   protocol "two_web" 
   forward to <table_two> check tcp 

}
pf.conf
Code:
rdr-anchor "relayd/*" 
anchor "relayd/*"
 
Just a bit of educated guessing here (I don't use relayd).

But looking at the config relayd seems to monitor the connection and looks for the tell-tale HTTP 1.1 Host: header. Depending on which one it finds it will dynamically add rules to pf to forward the traffic to the correct host.
 
Back
Top