Serve web-client on port 8000, to keep 80 usable

This commit is contained in:
MaMe82 2018-08-23 03:02:12 +02:00
parent db0827e155
commit 39f0a933fc
2 changed files with 2 additions and 1 deletions

View File

@ -40,7 +40,7 @@ func main() {
*/
// ToDo: The webroot has to be changed to /usr/local/P4wnP1/www
service.StartRpcServerAndWeb("0.0.0.0", "50051", "80", "/usr/local/P4wnP1/www") //start gRPC service
service.StartRpcServerAndWeb("0.0.0.0", "50051", "8000", "/usr/local/P4wnP1/www") //start gRPC service
//Indicate servers up with LED blink count 1
state.Led.SetLed(&pb.LEDSettings{1})

View File

@ -432,6 +432,7 @@ func StartRpcServerAndWeb(host string, gRPCPort string, webPort string, absWebRo
grpc_web_srv := grpcweb.WrapServer(s, grpcweb.WithWebsockets(true)) //Wrap server to improbable grpc-web with websockets
//define a handler for a HTTP web server using the gRPC-web proxy
http_gRPC_web_handler := func(resp http.ResponseWriter, req *http.Request) {
//fmt.Printf("===========\nRequest: %s\n %v\n=============\n", req)
if strings.Contains(req.Header.Get("Content-Type"), "application/grpc") ||
req.Method == "OPTIONS" ||
strings.Contains(req.Header.Get("Sec-Websocket-Protocol"), "grpc-websockets") {