Comments (9)
Yes, it is marked as experimental currently. I will confirm with the team if can remove experimental status
from grpc-go.
There are no plans to stabilize the functionality. gRPC's HTTP/2 server provides more features than the Go HTTP server and we haven't yet heard any critical use cases that require the Go HTTP server, so it's hard to justify spending time improving it.
from grpc-go.
@ekky-kharismadhany do you have any specific use case that's relevant here?
from grpc-go.
Hi, sorry for the late reply
I currently working on some application that use grpc-gateway project. On those projects, my organization uses same port to serve RESTful API and gRPC.
The current implementation is using a third-party library which currently does not have any update for the last 3 years. So, I'm searching a method to handle this issue and found that server.ServeHTTP
can be used to solve my organization issue.
That being said, do you have any recommendation or experience on how an application can serve both RESTful and gRPC at the same port?
Thank you
from grpc-go.
Another way I used that API was by wrapping it with an HTTP middleware it could serve also grpc-web requests. It required h2 also for grpc-web requests, but it worked well for unary and server streaming RPCs.
There are some implementations that offer also grpc-web, it might be considered.
from grpc-go.
Hi @isgj , I also use h2c for my proof-of-concept code. It works well.
server := grpc.NewServer(opts...)
reflection.Register(server)
echo_rpc.RegisterEchoServerServer(server, initServer())
logger.Info("server started", "host", host)
multiServer := http.Server{
Handler: h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.ProtoMajor == 2 && r.Header.Get("content-type") == "application/grpc" {
server.ServeHTTP(w, r)
} else {
mux.ServeHTTP(w, r)
}
}), &http2.Server{}),
}
if err := multiServer.Serve(listener); err != nil {
panic(err.Error())
}
from grpc-go.
Better approach would be to have a proxy or custom middleware for routing traffic accordingly. Alternatively, you can consider libraries like cmux to multiplex connections based on their payload
from grpc-go.
Hi @purnesh42H
cmux is the third-party project I referred to earlier in this issue. I'm looking for an alternative to cmux. But your approach on using proxy or a custom middleware is interesting. Could you elaborate those approaches, please?
Thank you
from grpc-go.
Related Issues (20)
- pickfirst: Don't use internal.ShuffleAddressListForTesting directly HOT 1
- grpc usage on unix sockets: strange grpc registry behaviour HOT 2
- Question about option experimental.WithRecvBufferPool HOT 2
- Flake: Test/BlockingPickSCNotReady
- Valid allow-all Authz Policy return permission denied HOT 10
- bug: `FATAL: [core] grpc: Server.RegisterService found duplicate service registration for "grpc.health.v1.Health"` HOT 3
- dualstack: Move resolver re-resolution out of subconn and into pickfirst HOT 1
- Issue: DirectPath side effect imports increase binary size by ~16MiB HOT 2
- xDS load reporting is not populating `total_issued_requests` field in LRS reports
- Reasoning about retry throttling parameters
- Add cancel cause when client sends RST_STREAM frame HOT 3
- Requests go through after about 1000s (16-17 minutes) HOT 11
- NewClient functions behaviour is incompatible with secure forward-proxies HOT 7
- How to give grpc connection Creating a Listener HOT 2
- Dependency on "testing" from "google.golang.org/grpc/experimental/stats" HOT 4
- encoding.GetCodec(proto.Name) broke in 1.66.0
- Create tests for two potential cardinality violation bugs
- Backport #7571 to 1.66 once merged HOT 1
- Why is Metadata still being used instead of Attributes in clientconn.go?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-go.