Evil Relayd

httpd relayd OBSD-6.7-cur


From the start I wanted to stick to base as much as possible, I have configured dns with unbound (cannot be simpler).

As of now, I have icecast and znc running on different port, so each time instead of navigating with <IP>:<port> I want path to redirect ie <IP>/znc --> <IP>:<znc_port> and <IP>/ice --> <IP>:<icecast_port>

On ngnix, I believe it's achieved with "proxy_pass", I know for a fact relayd is what I'm looking for as httpd just serves.

After reading man found all the neccessary details about features but not many examples on web. Relayd has filter, the one that fits is path /<path>?<value>. Make a protocol and use that for relay or redirection.

<httpd> { IP }
<znc>   { IP }
<ice>  	{ IP }

protocol reverse_proxy {
	return error

	match request quick path "/znc" forward to <znc>
	match request quick path "/ice" forward to <ice>

relay path_redirection {

	listen on * port 80

	protocol reverse_proxy
	forward to <table> port 80

	forward to <znc> port <znc_port>
	forward to <ice> port <ice_port>

Above won't do as it doesn't remove the /znc path, it's redirecting to :<znc_port>/znc

#Taken for "Relayd and Httpd Mastery" 
#removes only when value Apache 2.4 is matched 
match response header remove "Server" value "Apache 2.4"

This got me wondering,

match response path remove "/znc" path "/znc" forward to <znc> 

should get the job done.

But no, I spent my day figuring why this isn't, it indeed redirect to <znc_port> but along with the iniial path "/znc"

STFW all day, I'm totally lost at this point.