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

2016-07-26 Thread 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  { 127.0.0.1 }
table  { 127.0.0.1 }

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

relay www {
  listen on $relayd_address port 80
  protocol reverse_proxy
  forward to  check tcp port 81
  forward to  check tcp port 3000
}


On Tue, Jul 26, 2016 at 11:27 PM, Comète  wrote:

> 26 juillet 2016 12:20 "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 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=140508090726719=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/



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

2016-07-26 Thread Comète
26 juillet 2016 12:20 "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 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=140508090726719=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/



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

2016-07-26 Thread Solène 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 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=140508090726719=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.



httpd (+ relayd ?) URL redirection, anyone?

2016-07-26 Thread 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 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=140508090726719=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.



Re: relayd url redirection

2015-03-25 Thread Frederic URBAN
Hi all,

I'm try to reproduce such a setup with relayd on OpenBSD 5.7-current. 
Many change between the latest stable and the -current... I followed 
changes in relayd.conf(5) but i'm still not able to get a working solution.

This is a draft, my first contact with relayd. My objective is to use 
one virtual IPv4 public address to reach multiple webservices.

here is my relayd.conf, the behavior is quite simple, every GET goes on 
web1 host, any clue ?

table web1 { 192.168.228.73 }
table web2 { 192.168.228.50 }

http protocol http_tls {
 match header append X-Forwarded-For value $REMOTE_ADDR
 match header append X-Forwarded-By value 
$REMOTE_ADDR:$SERVER_PORT
 match header set Keep-Alive value $TIMEOUT

 match request url web1/ forward to web1
 match request url web2/ forward to web2

 tls { tlsv1, ciphers MEDIUM:HIGH }
 tls ca key /etc/ssl/private/server.key password ReallyWantIt?
 tls ca cert /etc/ssl/ca.crt
}

relay tls_accel {
 listen on 192.168.228.101 port 443 tls
 protocol http_tls
 forward to web1 port 80 check tcp
 forward to web2 port 80 check tcp
}

Frédéric.


Le 11/07/2014 14:12, Reyk Floeter a écrit :
 Hi,

 On Fri, Jun 20, 2014 at 10:35:13PM -0400, Predrag Punosevac wrote:
 I am seriously reading realyd man pages for the first time in my life.
 Namely I am after url suffix redirection. I will try to explain little
 bit better.

 I have close to 10 virtual hosts running behind OpenBSD firewall which
 has a single public IP address. My boss insists that all virtual hosts
 be reachable on the port 80. Can relayd do url suffix redirection? What
 I mean is a map:

 www.autonlab.org   10.0.0.0 host
 www.autonlab.org/web1  10.0.0.1 host
 www.autonlab.org/web2  10.0.0.2 host
 www.autonlab.org/web3  10.0.0.3 host

 and so on. Until now I was using nginx as a proxy and port redirection

 www.autonlab.org    10.0.0.0
 www.autonlab.org:8080   10.0.0.1

 and so on so forth.

 I didn't answer before because it was not supported by relayd but I
 was working on the filter upgrade that got committed yesterday.

 Your mail was almost a month ago, so you probably found another
 solution now, but it works in -current and the upcoming release with
 something like the following:

 ---snip---
 table web0 { 10.0.0.0 }
 table web1 { 10.0.0.1 }
 table web2 { 10.0.0.2 }
 table web3 { 10.0.0.3 }

 http protocol autonlab {
   return error
   pass
   match request patch /web1* forward to web1
   match request patch /web2* forward to web2
   match request patch /web3* forward to web3
 }

 relay autonlab {
   listen on 128.2.204.171 port 80
   protocol autonlab

   # Main server table
   forward to web0 check tcp port 80

   # Additional server tables used by custom rules
   forward to web1 check tcp port 80
   forward to web2 check tcp port 80
   forward to web3 check tcp port 80
 }
 ---snap---

 Reyk

-- 
Frédéric URBAN
*Frédéric URBAN*
Ingénieur Réseaux

frederic.ur...@ircad.fr mailto:frederic.ur...@ircad.fr
Tél. : +33 (0)3 88 119 038
IRCAD France
http://www.ircad.fr/ http://www.ircad.fr/

Suivez l'IRCAD sur Facebook 
http://www.facebook.com/pages/IRCAD/193785273990141

*IRCAD France*
Hôpitaux Universitaires - 1, place de l'Hôpital - 67091 Strasbourg Cedex 
- FRANCE



relayd url redirection

2014-10-05 Thread Olivier Cherrier
Hi,

Following http://marc.info/?l=openbsd-miscm=140508090726719w=2,
I'm trying to implement a similar setup.

relayd(8) is listening on a public IP.
httpd(8) is listening on localhost:80 and apache-httpd-openbsd is
listening on localhost:81.

I would like to handle all traffic with httpd(8) and only UserDir URLs
(/~user) with apache-httpd-openbsd.

I tried :

ext_addr=x.x.x.x
table web_httpd { 127.0.0.1 }
table web_apache { 127.0.0.1 }
http protocol filters {
return error
# pass # not needed.

# tried these forms:
match request quick path /~* forward to web_apache
match request quick path /~user/* forward to web_apache

match request path * forward to web_httpd
}
relay site1 {
listen on $ext_addr port 80
protocol filters
forward to web_httpd check tcp port 80
forward to web_apache check tcp port 81
}


But it half works. Sometimes it works and sometimes the UserDir traffic
is sent to httpd(8) and the non-UserDir traffic is sent to Apache.

I tried to use a public IP for binding web_apache (still on port
81) but it failed in the exact same way. 
In case there is a problem with the '~' character, I also tried to use
something like /user for the string. But it did the same.


Does anybody have any idea how to get it working ?

Thanks for any hint !
Best.
Olivier








-- 
Olivier Cherrier - Symacx.com
Phone: +352691754777
mailto:o...@symacx.com



Re: relayd url redirection

2014-07-11 Thread Reyk Floeter
Hi,

On Fri, Jun 20, 2014 at 10:35:13PM -0400, Predrag Punosevac wrote:
 I am seriously reading realyd man pages for the first time in my life.
 Namely I am after url suffix redirection. I will try to explain little
 bit better.
 
 I have close to 10 virtual hosts running behind OpenBSD firewall which
 has a single public IP address. My boss insists that all virtual hosts
 be reachable on the port 80. Can relayd do url suffix redirection? What
 I mean is a map:
 
 www.autonlab.org   10.0.0.0 host
 www.autonlab.org/web1  10.0.0.1 host
 www.autonlab.org/web2  10.0.0.2 host
 www.autonlab.org/web3  10.0.0.3 host
 
 and so on. Until now I was using nginx as a proxy and port redirection
 
 www.autonlab.org    10.0.0.0
 www.autonlab.org:8080   10.0.0.1
 
 and so on so forth.
 

I didn't answer before because it was not supported by relayd but I
was working on the filter upgrade that got committed yesterday.

Your mail was almost a month ago, so you probably found another
solution now, but it works in -current and the upcoming release with
something like the following:

---snip---
table web0 { 10.0.0.0 }
table web1 { 10.0.0.1 }
table web2 { 10.0.0.2 }
table web3 { 10.0.0.3 }

http protocol autonlab {
return error
pass
match request patch /web1* forward to web1
match request patch /web2* forward to web2
match request patch /web3* forward to web3
}

relay autonlab {
listen on 128.2.204.171 port 80
protocol autonlab

# Main server table
forward to web0 check tcp port 80

# Additional server tables used by custom rules
forward to web1 check tcp port 80
forward to web2 check tcp port 80
forward to web3 check tcp port 80
}
---snap---

Reyk



Re: relayd url redirection

2014-07-11 Thread Predrag Punosevac
Reyk Floeter r...@openbsd.org wrote:

 Hi,
 
 On Fri, Jun 20, 2014 at 10:35:13PM -0400, Predrag Punosevac wrote:
  I am seriously reading realyd man pages for the first time in my life.
  Namely I am after url suffix redirection. I will try to explain little
  bit better.
  
  I have close to 10 virtual hosts running behind OpenBSD firewall which
  has a single public IP address. My boss insists that all virtual hosts
  be reachable on the port 80. Can relayd do url suffix redirection? What
  I mean is a map:
  
  www.autonlab.org   10.0.0.0 host
  www.autonlab.org/web1  10.0.0.1 host
  www.autonlab.org/web2  10.0.0.2 host
  www.autonlab.org/web3  10.0.0.3 host
  
  and so on. Until now I was using nginx as a proxy and port redirection
  
  www.autonlab.org    10.0.0.0
  www.autonlab.org:8080   10.0.0.1
  
  and so on so forth.
  
 
 I didn't answer before because it was not supported by relayd but I
 was working on the filter upgrade that got committed yesterday.
 
 Your mail was almost a month ago, so you probably found another
 solution now, but it works in -current and the upcoming release with
 something like the following:
 
 ---snip---
 table web0 { 10.0.0.0 }
 table web1 { 10.0.0.1 }
 table web2 { 10.0.0.2 }
 table web3 { 10.0.0.3 }
 
 http protocol autonlab {
   return error
   pass
   match request patch /web1* forward to web1
   match request patch /web2* forward to web2
   match request patch /web3* forward to web3
 }
 
 relay autonlab {
   listen on 128.2.204.171 port 80
   protocol autonlab
 
   # Main server table
   forward to web0 check tcp port 80
 
   # Additional server tables used by custom rules
   forward to web1 check tcp port 80
   forward to web2 check tcp port 80
   forward to web3 check tcp port 80
 }
 ---snap---
 
 Reyk

Hi Reyk,

Thank you so much for this and your previous work on relayd and other
components of OpenBSD! I am testing current right now and I will most
definitely try this. I ended up using Nginx as Antoine suggested.

Predrag



Re: relayd url redirection

2014-06-27 Thread Predrag Punosevac
For people who might stumble on this thread I ended up using Nginx with
a configuration file which looks similar to this.

Predrag


# $OpenBSD: nginx.conf,v 1.16 2014/01/28 14:48:53 stephan Exp $

#user  www;
worker_processes  4;

#syslog local5  nginx;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log  syslog:notice|logs/error.log;

#pidlogs/nginx.pid;


events {
worker_connections  1024;
}


http {
include   mime.types;
default_type  application/octet-stream;
index index.html index.htm;

#log_format  main  '$remote_addr - $remote_user [$time_local] $request '
#  '$status $body_bytes_sent $http_referer '
#  '$http_user_agent $http_x_forwarded_for';

#access_log  logs/access.log  main;
#access_log  syslog:notice|logs/access.log main;

#tcp_nopush on;

keepalive_timeout  65;

server_tokens off;

# Virtual hosts 
server { 
listen   myIP:80;
server_name  www.test.org;
location /www1 { 
proxy_pass http://www1.int.test.org;
proxy_next_upstream error timeout invalid_header http_500 http_502 
http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP   $remote_addr;
proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;
}
location /www2 {
proxy_pass http://www2.int.test.org;
proxy_next_upstream error timeout invalid_header http_500 http_502 
http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP   $remote_addr;
proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;
}
}

}



Re: relayd url redirection

2014-06-21 Thread Antoine Jacoutot
On Fri, Jun 20, 2014 at 10:35:13PM -0400, Predrag Punosevac wrote:
 I am seriously reading realyd man pages for the first time in my life.
 Namely I am after url suffix redirection. I will try to explain little
 bit better.
 
 I have close to 10 virtual hosts running behind OpenBSD firewall which
 has a single public IP address. My boss insists that all virtual hosts
 be reachable on the port 80. Can relayd do url suffix redirection? What
 I mean is a map:
 
 www.autonlab.org   10.0.0.0 host
 www.autonlab.org/web1  10.0.0.1 host
 www.autonlab.org/web2  10.0.0.2 host
 www.autonlab.org/web3  10.0.0.3 host
 
 and so on. Until now I was using nginx as a proxy and port redirection

You can do that with nginx without the need for port redirection if I am not 
mistaken.
Using proxy_pass in your Location.

-- 
Antoine



Re: relayd url redirection

2014-06-21 Thread Sebastian Benoit
Predrag Punosevac(punoseva...@gmail.com) on 2014.06.20 22:35:13 -0400:
 I am seriously reading realyd man pages for the first time in my life.
 Namely I am after url suffix redirection. I will try to explain little
 bit better.

relayd cannot do this currently unfortunatly.

/Benno



Re: relayd url redirection

2014-06-21 Thread vadimou
On 6/20/14, Predrag Punosevac punoseva...@gmail.com wrote:
 and so on. Until now I was using nginx as a proxy and port redirection

I agree with Antoine. Read the nginx manual carefully. All you need is there.



relayd url redirection

2014-06-20 Thread Predrag Punosevac
I am seriously reading realyd man pages for the first time in my life.
Namely I am after url suffix redirection. I will try to explain little
bit better.

I have close to 10 virtual hosts running behind OpenBSD firewall which
has a single public IP address. My boss insists that all virtual hosts
be reachable on the port 80. Can relayd do url suffix redirection? What
I mean is a map:

www.autonlab.org   10.0.0.0 host
www.autonlab.org/web1  10.0.0.1 host
www.autonlab.org/web2  10.0.0.2 host
www.autonlab.org/web3  10.0.0.3 host

and so on. Until now I was using nginx as a proxy and port redirection

www.autonlab.org    10.0.0.0
www.autonlab.org:8080   10.0.0.1

and so on so forth.

Thanks for the input!

Predrag