-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support serving web content from the same port #75
Comments
I just realized the grpc tls alpn is just HTTP/2 drafts, not a separate protocol. Scratch that plan; the splitting of grpc vs other needs to happen more per-{request|stream|something}. |
I’d be interested in this as well. |
Since there's no grpc/grpc-experiments#152 Can there be a failover stream handler? If the grpc server cannot process the stream (the service/method doesn't exist for instance) we could have another handler that devs can define to process it. |
Yup, I think adding some additional handlers for non-grpc content is the way to go just like what we have done for google internal rpc framework. I will raise it to design discussion and get back to you once we have a decision. |
From grpc/grpc-experiments#152: There's a mandatory content type for grpc. So streams that do not have it can be served by the default http handler. |
Any news on this? Should we go ahead and make a PR? |
@iamqizhao Have you had the discussion yet? Any decision? Anything I can help to make this happen? |
I think this is good to have. But I do not see a compelling demand to have On Wed, Apr 22, 2015 at 10:53 AM, Xiang Li notifications@github.com wrote:
|
@iamqizhao I can work on it. Motivation:
So ideally, grpc can forward http1 requests to my old handlers. But can you give me some direction to do that? I can start to explore and hopefully have a pr for it. |
On Wed, Apr 22, 2015 at 11:16 AM, Xiang Li notifications@github.com wrote:
You can probably check https://github.com/gengo/grpc-gateway to see if
|
It seems @bradfitz's http2 server supports both http1 and http2 at the same time. Here is the related code https://github.com/bradfitz/http2/blob/91f80303028022bc2034c277126b405a2257d990/server.go#L185-L192 Are we able to do the similar thing? |
On Wed, Apr 22, 2015 at 4:04 PM, Xiang Li notifications@github.com wrote:
|
okay, my proposal is sketched as follows: we can implement a handshaker. The client connects to a http.Server and On Wed, Apr 22, 2015 at 4:33 PM, Qi Zhao toqizhao@gmail.com wrote:
|
Why not use HTTP Upgrade? |
On Wed, Apr 22, 2015 at 5:50 PM, Brian Akins notifications@github.com
|
This discussion should happen in the normal grpc discussion places first, not in grpc-go. Once a language-neutral plan is agreed upon, then grpc-go can implement it. In the meantime, users outside of grpc-go can implement a net.Listener/net.Conn that sniffs the beginning traffic and routes depending on whether it looks like a TLS handshake (with the ALPN for "h2") or an plaintext HTTP/1 request "GET / HTTP/1.1" etc. But let's please not do some gprc-go-specific hack here if other languages don't do the same. |
@bradfitz Agreed. I will move the discussion to grpc. |
@bradfitz That part doesn't help differentiate web traffic from grpc traffic, when they both happen to run over TLS & even the same ALPN. That really is the interesting part. Actually, I don't see the grpc protocol spec saying anything about what part of it is so special that it can't just look like POST requests to |
It's hard to design something until there's a defined problem. |
@tv42 Doesn't the mandatory "Content-Type: application/grpc" work for differentiating between grpc and plain http requests? Granted that's once the handshake has passed. |
@acasajus Sure, it would, but right now grpc seems to sort of reimplement part of |
@tv42, yeah, grpc-go was developed in parallel with bradfitz/http2. They share a framer, but they have different server implementations. So it's not exactly clear whether and where it would be possible to make one defer to the other. I'd personally like to see them unified someday, perhaps with grpc-go just being a handler under http2 itself, using the http2 server code. But then, grpc might be faster doing it by hand. I'm not sure. |
I actually don't know. I just assumed there was one, since they have a fancy website (http://www.grpc.io/) and all. |
Started the conversation here: https://groups.google.com/d/msg/grpc-io/JnjCYGPMUms/JDmi9-UpDuoJ |
I tend to agree on this https://groups.google.com/forum/#!topic/grpc-io/JnjCYGPMUms. (grpc-java plan) Can we do something similar in grpc-go? Thanks. |
As the originator of this issue, I'd like to say this: I really don't care about running gRPC over HTTP/1.1. If you want that, please make a separate issue. What I want is to have a single TCP port that can be accessed both with a modern browser and a gRPC client, where both behave sanely. That can mean always TLS and all gRPC over HTTP/2; whether the browser uses HTTP/2 or HTTP/1.1 is not relevant. |
On Mon, May 18, 2015 at 10:08 AM, Xiang Li notifications@github.com wrote:
|
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Updates grpc#75
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
This adds new http.Handler-based ServerTransport in the process, reusing the HTTP/2 server code in x/net/http2 or Go 1.6+. All end2end tests pass with this new ServerTransport. Fixes grpc#75 Also: Updates grpc#495 (lets user fix it with middleware in front) Updates grpc#468 (x/net/http2 validates) Updates grpc#147 (possible with x/net/http2) Updates grpc#104 (x/net/http2 does this)
https://github.com/grpc/grpc-common/blob/master/PROTOCOL-HTTP2.md#appendix-a---grpc-for-protobuf says grpc protobuf mapping uses service names as paths. Would it be possible to serve web content from other urls?
I see TLS side does alpn, so that's an easy place to hook up.
Any thoughts about non-TLS? e.g. a service running on localhost. Of course that would mean needing to do a http/1 upgrade negotiation, as then the port could not default to http/2.
Use case 1: host a web application and its api on the same port.
Use case 2: serve a health check response.
Use case 3: serve a "nothing to see here" html page.
Use case 4: serve a /robots.txt file.
The text was updated successfully, but these errors were encountered: