Virtual host / ServeMux project?

527 views
Skip to first unread message

Kyle Wolfe

unread,
Dec 9, 2013, 5:32:23 PM12/9/13
to golan...@googlegroups.com
I'm was kicking around the idea of my first real project being a standalone "virtual host" handler for routing multiple domains on port x to other services within the network like an apache virtual host would. I see that there is ServeMux however from what I am reading this would require those services to be part of the same binary since its routing to a handler.

So 1) am I missing anything that would make this project not useful and 2) anyone know of one that exists already.

Wes Freeman

unread,
Dec 9, 2013, 5:35:49 PM12/9/13
to Kyle Wolfe, golang-nuts
Not to discourage you, but depending what you're looking for, maybe gorilla/mux can handle it?


Wes

On Mon, Dec 9, 2013 at 5:32 PM, Kyle Wolfe <kyle.a...@gmail.com> wrote:
I'm was kicking around the idea of my first real project being a standalone "virtual host" handler for routing multiple domains on port x to other services within the network like an apache virtual host would. I see that there is ServeMux however from what I am reading this would require those services to be part of the same binary since its routing to a handler.

So 1) am I missing anything that would make this project not useful and 2) anyone know of one that exists already.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Wes Freeman

unread,
Dec 9, 2013, 6:11:46 PM12/9/13
to Kyle Wolfe, golang-nuts
Sorry, I guess I misunderstood and thought you just wanted to route on hostnames. So, you want to do that, but also forward requests?

mgutz

unread,
Dec 9, 2013, 6:28:11 PM12/9/13
to golan...@googlegroups.com
a reverse proxy? azer/boxcars on github

Rick Tait

unread,
Dec 9, 2013, 7:30:31 PM12/9/13
to golan...@googlegroups.com
i could be misunderstanding (or projecting!!!), but to me it sounds like Kyle might want a combo of gorilla/mux + nginx's vhost location+upstream functionality? gorilla/mux can certainly do it, it just isn't necessarily the prettiest (nicely packaged) thing in the whole world. 

kyle, if i'm on the right track, i would LOVE to see something like this. easily-configurable multiple vhost+routing without having to recompile every time i add a new vhost (etc). 

forgive if i'm way off base!

RMT.


On Monday, December 9, 2013 2:32:23 PM UTC-8, Kyle Wolfe wrote:

Kyle Wolfe

unread,
Dec 10, 2013, 10:12:57 AM12/10/13
to golan...@googlegroups.com
gorilla/mux seems to be the same thing. it would require a restart of the service if any one of the hosts need an update because it routes to a handler. I am suggesting more of a proxy, but boxcars might be a little overkill as well.

What I had in mind would start a service on port 80 / 443 and act as a proxy to defined services based on host name. Most setups would route to localhost on a different port number.

virtualhost - port 80
---------------------------
foo.net -> localhost:81
bar.net -> localhost:82
sub.bar.net -> localhost:83

Now each service can be taken down independently. Most likely would have a simple web ui to add hosts without taking down the virtual host service as well and save a config file for when a restart does occur.

Sol Toure

unread,
Dec 10, 2013, 10:54:04 AM12/10/13
to golang-nuts
For development I use this https://github.com/qrtz/livedev
It is not meant for production use but it might serve as starting point or just inspiration.


--

Kevin Gillette

unread,
Dec 10, 2013, 2:43:44 PM12/10/13
to golan...@googlegroups.com
Writing a hot-reconfigurable virtual-host revproxy is pretty specific: I wouldn't expect any existing Go project that's either (but not all of) hot-reconfigurable or domain-routes or is a reverse proxy to fulfill this need. It's also not too hard to write from scratch in Go.
Reply all
Reply to author
Forward
0 new messages