httpd (+ relayd ?) URL redirection, anyone?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

httpd (+ relayd ?) URL redirection, anyone?

Miles Keaton
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 <a href="http://127.0.0.1:3000;">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.

Reply | Threaded
Open this post in threaded view
|

Re: httpd (+ relayd ?) URL redirection, anyone?

Solene Rapenne
Le 2016-07-26 12:13, Miles Keaton a écrit :

> 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 <a href="http://127.0.0.1:3000;">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.

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.

Reply | Threaded
Open this post in threaded view
|

Re: httpd (+ relayd ?) URL redirection, anyone?

Comète-2
In reply to this post by Miles Keaton
26 juillet 2016 12:20 "Miles Keaton" <[hidden email]> a écrit:
> 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 <a href="http://127.0.0.1:3000;">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.


Hi,

maybe this should help you:
https://www.reddit.com/r/openbsd/comments/3qb2c4/some_observations_about_rela
yd/

Reply | Threaded
Open this post in threaded view
|

Re: httpd (+ relayd ?) URL redirection, anyone?

Miles Keaton
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
}


On Tue, Jul 26, 2016 at 11:27 PM, Comète <[hidden email]> wrote:

> 26 juillet 2016 12:20 "Miles Keaton" <[hidden email]> a écrit:
> > 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 <a href="http://127.0.0.1:3000;">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.
>
>
> Hi,
>
> maybe this should help you:
>
>
>
https://www.reddit.com/r/openbsd/comments/3qb2c4/some_observations_about_rela
yd/