Discussion:
httpd (+ relayd ?) URL redirection, anyone?
(too old to reply)
Miles Keaton
2016-07-26 10:13:43 UTC
Permalink
Sorry to bother the list with this, but still stumped after two days.

Trying to switch from nginx to httpd, but there's just one thing left:

Having the webserver pass some URLs to another port:

# working nginx config:
http {
server {
listen 80;
# serving static here
root /var/www/htdocs/test;
# but this URL is sent to Ruby rack server
location = /hello {
proxy_pass http://127.0.0.1:3000;
}
}
}

I'm assuming I need relayd to do this, but still stumped after two days of
reading and experimenting with man 5 relayd.conf.

Found this answer from Reyk from two years ago:
https://marc.info/?l=openbsd-misc&m=140508090726719&w=2
... but maybe the syntax has changed since then, since relayd gives a syntax
error for that example, and any variation of it I've tried.

Any suggestions?

Thanks in advance.
Solène RAPENNE
2016-07-26 10:27:42 UTC
Permalink
Post by Miles Keaton
Sorry to bother the list with this, but still stumped after two days.
http {
server {
listen 80;
# serving static here
root /var/www/htdocs/test;
# but this URL is sent to Ruby rack server
location = /hello {
proxy_pass http://127.0.0.1:3000;
}
}
}
I'm assuming I need relayd to do this, but still stumped after two days
of
reading and experimenting with man 5 relayd.conf.
https://marc.info/?l=openbsd-misc&m=140508090726719&w=2
... but maybe the syntax has changed since then, since relayd gives a
syntax
error for that example, and any variation of it I've tried.
Any suggestions?
Thanks in advance.
Hello,

from http.conf(5) there is no way to redirect to a http server with
httpd.
It seems to only supports fastcgi with a socket.
Comète
2016-07-26 11:27:42 UTC
Permalink
Post by Miles Keaton
Sorry
to bother the list with this, but still stumped after two days.
Post by Miles Keaton
Trying to
Having the
http
{
Post by Miles Keaton
server {
listen 80;
# serving static here
root /var/www/htdocs/test;
# but this URL is sent to Ruby rack server
location = /hello {
proxy_pass http://127.0.0.1:3000;
Post by Miles Keaton
}
}
}
I'm assuming I need relayd
to do this, but still stumped after two days of
Post by Miles Keaton
reading and experimenting
with man 5 relayd.conf.
https://marc.info/?l=openbsd-misc&m=140508090726719&w=2
Post by Miles Keaton
... but maybe the
syntax has changed since then, since relayd gives a syntax
Post by Miles Keaton
error for that
example, and any variation of it I've tried.
Post by Miles Keaton
Any suggestions?
Thanks
in advance.


Hi,

maybe this should help you:
https://www.reddit.com/r/openbsd/comments/3qb2c4/some_observations_about_rela
yd/
Miles Keaton
2016-07-26 12:10:31 UTC
Permalink
Good find. Thank you! That helped a lot. This relayd.conf works now, if I
switch httpd to listen to port 81:

relayd_address="127.0.0.1"
table <httpd> { 127.0.0.1 }
table <ruby> { 127.0.0.1 }

http protocol reverse_proxy {
match request path "/hello" forward to <ruby>
match response header set "Connection" value "close"
tcp { nodelay, sack }
}

relay www {
listen on $relayd_address port 80
protocol reverse_proxy
forward to <httpd> check tcp port 81
forward to <ruby> check tcp port 3000
}
Post by Miles Keaton
Post by Miles Keaton
Sorry to bother the list with this, but still stumped after two days.
http {
server {
listen 80;
# serving static here
root /var/www/htdocs/test;
# but this URL is sent to Ruby rack server
location = /hello {
proxy_pass http://127.0.0.1:3000;
}
}
}
I'm assuming I need relayd to do this, but still stumped after two days
of
Post by Miles Keaton
reading and experimenting with man 5 relayd.conf.
https://marc.info/?l=openbsd-misc&m=140508090726719&w=2
... but maybe the syntax has changed since then, since relayd gives a
syntax
Post by Miles Keaton
error for that example, and any variation of it I've tried.
Any suggestions?
Thanks in advance.
Hi,
https://www.reddit.com/r/openbsd/comments/3qb2c4/some_observations_about_rela
yd/

Loading...