johanbrandhorst / grpcweb-example

An example implementation of a GopherJS client and a Go server using the Improbable gRPC-Web implementation
MIT License
95 stars 12 forks source link

Using HTTP in development mode produces errors #15

Closed ghost closed 6 years ago

ghost commented 6 years ago

cd /Users/apple/workspace/go/src/github.com/johanbrandhorst/grpcweb-example && go run main.go INFO[2018-02-15T08:35:36.242571+01:00] Serving on https://localhost:10000 2018/02/15 08:35:40 http: TLS handshake error from 127.0.0.1:50771: tls: first record does not look like a TLS handshake

ghost commented 6 years ago

https://127.0.0.1:10000/ works but needs a cert.

  1. Automatic redirect to https
  2. CMD to install cert to browser. Saw golang code for this somewhere.
johanbrandhorst commented 6 years ago

Hi, thanks for the issue report!

As you noticed, this happens if you navigate to http://localhost:10000 instead of https://localhost:10000. Personally, I don't consider this too much of a problem as the URL you should be using for development is clearly listed, and adding extra bloat to the server for this rare use case is just unnecessary.

As for installing the cert int the browser, I don't know how to do this via Go, but again, this is just a problem for development mode and I don't think it matters all that much. Personally I just ignore the certificate problem since I know I'm running it on my local machine.

ghost commented 6 years ago

Fair enough.. I will then add it to the CI repo. I need the Self signed Cert to work because:

johanbrandhorst commented 6 years ago

Sure, I'm not saying you can't decide to trust the self signed cert, but it's a pretty specific use case, and a general solution probably won't be necessary.

ghost commented 6 years ago

In the end i went with Cloudflare Warp.

https://www.cloudflare.com/products/cloudflare-warp/ https://github.com/caddyserver/cloudflare-warp-plugin

johanbrandhorst commented 6 years ago

Cool, sounds like the same as https://ngrok.com/