HTTP proxy in OpenBSD 5.8 (replacing Apache ProxyPass)

openbsdopenbsd-httpdreverse-proxy

I'm trying to replace Apache with OpenBSDs httpd but can't figure out what to do with my ProxyPass statements.

In apaches conf it looks like this

 ProxyPass /someurl http://192.168.123.123/someotherurl
 ProxyPassReverse /someurl http://192.168.123.123/someotherurl
  • I thought I should use relayd for this, but how do I do the URL rewrite?
  • Would I set up relayd to listen on port 80 and forward some things to different internal machines and the rest to httpd on localhost?

Best Answer

Great question! OpenBSD's newly written httpd is not a fully-featured web-server, and nor is it intended to be. As for relayd, which was the precursor to httpd, I do not believe that it has any ability to do what you require, either.

The best general-purpose replacement for Apache bar none is still nginx.

It is readily available in the OpenBSD ports tree as www/nginx, and can be easily installed as a precompiled package with pkg_add(1) — doas pkg_add nginx.

Once you install nginx, you would use the proxy_pass directive, and it'll probably look like this:

location /someurl {
    proxy_pass http://192.168.123.123/someotherurl; 
}

As for ProxyPassReverse, nginx has a more appropriate name for it — proxy_redirect, and the default value of default should already be sufficient for your needs (that is, if your ProxyPassReverse and ProxyPass directives both had the same value). Good luck!

Related Question