Giter Club home page Giter Club logo

Comments (4)

juliens avatar juliens commented on September 21, 2024

Hi,

I'm sorry but I was not able to reproduce it. Since I utilized a basic HelloWorld for the gRPC backend, I'm considering the possibility that there may be an issue with something in your gRPC backend.

Could you provide a reproducible use case with a public container image as backend?

from traefik.

mjpitz avatar mjpitz commented on September 21, 2024

There's definitely nothing wrong with the gRPC backend. I verified this by dialing it directly without the proxy in between. I'm running a fairly standard setup where I have an H2C server peek at the request protocol and content-type header and then route the request to the appropriate backend server (HTTP or gRPC). No TLS on the server side (termination happens at the Traefik layer). I know the backend isn't even receiving the request because of bookend logging I put into place.

	bookend := log.Named("bookend")
	handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		bookend.Debug("start", zap.String("method", r.Method), zap.String("path", r.URL.Path))
		defer bookend.Debug("end", zap.String("method", r.Method), zap.String("path", r.URL.Path))

		if r.ProtoMajor == 2 && strings.HasPrefix(r.Header.Get("content-type"), "application/grpc") {
			public.GRPC.Server.ServeHTTP(w, r)
		} else {
			public.HTTP.Handler.ServeHTTP(w, r)
		}
	})

	public.H2C.Server = &http.Server{
		Handler: h2c.NewHandler(handler, &http2.Server{}),
		ConnContext: func(ctx context.Context, c net.Conn) context.Context {
			return logger.ToContext(ctx, log)
		},
	}
	
	return svr.H2C.Server.Serve(svr.listener)

Client isn't doing anything fancy either. Really just a direct dial with transport credentials set to the system cert pool.

	pool, err := x509.SystemCertPool()
	if err != nil {
		return nil, err
	}

	creds = credentials.NewTLS(&tls.Config{
		RootCAs:            pool,
		InsecureSkipVerify: c.Mode == "dev",
	})

	dialOptions := []grpc.DialOption{
		grpc.WithAuthority(c.BaseURL),
		grpc.WithTransportCredentials(creds),
	}

	clientConn, err := grpc.DialContext(context.Background(), net.JoinHostPort(host, port), dialOptions...)
	if err != nil {
		return nil, err
	}

I've tried this both with and without the WithAuthority option.

from traefik.

juliens avatar juliens commented on September 21, 2024

Hi,

I'm still not able to reproduce it, and a complete reproducible use case ( may be with a docker-compose etc... ) would be very helpful.

Could you share the /api/rawdata and can you try to enable accesslogs in json, you will have more information on the request etc..., and share the results.

Thanks

from traefik.

traefiker avatar traefiker commented on September 21, 2024

Hi! I'm Træfiker 🤖 the bot in charge of tidying up the issues.I have to close this one because of its lack of activity 😞Feel free to re-open it or join our Community Forum.

from traefik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.