Skip to content

bad practice on creating the tls credentials #25

@imansadooghi

Description

@imansadooghi

on cmd/serve.go: (line 84)
https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go#L84
dcreds := credentials.NewTLS(&tls.Config{ ServerName: demoAddr, RootCAs: demoCertPool, })
demoAddr is used for creating the credentials. demoAddr is an endpoint with address:port format. Using that will cause your TLS to look for a serverName of "localhost:10000". Hence, in your certificate, you had to add the domain:port specifically as a server name. It is not good practice to use a specific name in your cert. The ServerName should be only the Address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions