Domanda

The most part of my website is delivered with PHP and Apache, which works just fine. However I want to use Websocket for a page (or multiple pages). For the Websocket communication I want to use golang. To not let the clients run into any firewall problems Websocket should use the normal webport. (443 that is in this case - for the SSL version of Websocket).

Because Apache is already listening on that port, I need it to forward Websocket requests (or requests to a specific URL) to my golang program. (A single golang program must listen to all incoming websocket connections, to allow for easy communication between them.)

Is there a way to achieve that?

È stato utile?

Soluzione

one of the web servers must proxy for the other. So you need to either configure Apache to proxy requests to your Golang program, or incorporate a reverse proxy into your golang program to deal with the Apache content.

It's probably easier to configure Apache as a proxy than include the reverse proxy into your Golang code, but there is a standard lib for it: http://golang.org/pkg/net/http/httputil/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top