Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GzipMiddleware ¶
GzipMiddleware compresses HTTP responses and decompresses requests.
It handles both request decompression (Content-Encoding: gzip) and response compression (Accept-Encoding: gzip).
Requests without compression are handled normally for backward compatibility.
Types ¶
type BackendRegistry ¶
type BackendRegistry interface {
GetBackend(service string) (proxy.Backend, func(), bool)
HasBackend(service string) bool
}
BackendRegistry is the subset of backend lookup API required by the HTTP proxy.
GetBackend leases the returned backend: the caller must call the release function exactly once when it is done using the backend, or the connection may be kept open past the point it should have closed. HasBackend performs the same lookup without leasing, so a handler can reject an unregistered service before it pays for reading the request body.
type Option ¶
type Option func(*handlerOptions)
Option configures the HTTPHandler constructor.
func WithTrustedOrigins ¶ added in v0.3.0
WithTrustedOrigins sets the origins whose browser pages may read the handler's responses cross-origin.
A request from any other origin gets no CORS headers, so the browser withholds the response from the calling page.
type TransparentWebGRPCProxy ¶
type TransparentWebGRPCProxy struct {
// contains filtered or unexported fields
}
TransparentWebGRPCProxy is an HTTP handler that translates HTTP requests with binary protobuf payloads to gRPC calls.
func NewHTTPHandler ¶
func NewHTTPHandler(registry BackendRegistry, options ...Option) *TransparentWebGRPCProxy
NewHTTPHandler creates a new HTTPHandler.
func (*TransparentWebGRPCProxy) ServeHTTP ¶
func (m *TransparentWebGRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles HTTP requests.