mirror of
https://github.com/lightninglabs/aperture.git
synced 2026-02-23 10:24:26 +01:00
proxy: set Content-Type for gRPC requests
Prior we would not set the Content-Type header for grpc request, which on failure events would cause the response to be invalid gRPC responses, as the grpc code path in sendDirectResponse expects the Content-Type header to be set. This change fixes the problem by setting the Content-Type header to application/grpc for gRPC requests.
This commit is contained in:
@@ -134,6 +134,12 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// If the request is a gRPC request, we need to set the Content-Type
|
||||
// header to application/grpc.
|
||||
if strings.HasPrefix(r.Header.Get(hdrContentType), hdrTypeGrpc) {
|
||||
w.Header().Set(hdrContentType, hdrTypeGrpc)
|
||||
}
|
||||
|
||||
// Requests that can't be matched to a service backend will be
|
||||
// dispatched to the static file server. If the file exists in the
|
||||
// static file folder it will be served, otherwise the static server
|
||||
|
||||
Reference in New Issue
Block a user