Skip to content

Commit

Permalink
set grpc.WithInsecure() when not using tls
Browse files Browse the repository at this point in the history
  • Loading branch information
andyroyle committed Nov 22, 2018
1 parent a9b29af commit aa01e11
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions proxy/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import (
"context"
"crypto/tls"
"fmt"
"log"
"net"
"net/http"
"net/url"
"strings"
"time"

"github.com/fabiolb/fabio/config"
"github.com/fabiolb/fabio/metrics"
"github.com/fabiolb/fabio/route"
Expand All @@ -13,12 +20,6 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/stats"
"google.golang.org/grpc/status"
"log"
"net"
"net/http"
"net/url"
"strings"
"time"
)

type gRPCServer struct {
Expand Down Expand Up @@ -68,6 +69,8 @@ func GetGRPCDirector(tlscfg *tls.Config) func(ctx context.Context, fullMethodNam
// then you will need to override the servername
ServerName: target.Opts["grpcservername"],
})))
} else {
opts = append(opts, grpc.WithInsecure())
}

newCtx := context.Background()
Expand Down

0 comments on commit aa01e11

Please sign in to comment.