A collection of useful middleware for Go HTTP services & web applications. Package handlers is a collection of handlers (aka "HTTP middleware") for use with Go's net/http package (or any framework supporting http.Handler). LoggingHandler for logging HTTP requests in the Apache Common Log Format. CombinedLoggingHandler for logging HTTP requests in the Apache Combined Log Format commonly used by both Apache and nginx. Compress Chandler for gzipping responses. ContentTypeHandler for validating requests against a list of accepted content types. MethodHandler for matching HTTP methods against handlers in a map[string]http.Handler. ProxyHeaders for populating r.RemoteAddr and r.URL.Scheme based on the X-Forwarded-For, X-Real-IP, X-Forwarded-Proto and RFC7239 Forwarded headers when running a Go server behind a HTTP reverse proxy. CanonicalHost for re-directing to the preferred host when handling multiple domains (i.e. multiple CNAME aliases).

Features

  • CompressHandler for gzipping responses
  • RecoveryHandler for recovering from unexpected panics
  • LoggingHandler for logging HTTP requests in the Apache Common Log Format
  • Package handlers is a collection of handlers
  • LoggingHandler for logging HTTP requests in the Apache Common Log Format
  • CombinedLoggingHandler for logging HTTP requests in the Apache Combined Log Format commonly used by both Apache and nginx

Project Samples

Project Activity

See All Activity >

License

BSD License

Follow gorilla/handlers

gorilla/handlers Web Site

Other Useful Business Software
Forever Free Full-Stack Observability | Grafana Cloud Icon
Forever Free Full-Stack Observability | Grafana Cloud

Our generous forever free tier includes the full platform, including the AI Assistant, for 3 users with 10k metrics, 50GB logs, and 50GB traces.

Built on open standards like Prometheus and OpenTelemetry, Grafana Cloud includes Kubernetes Monitoring, Application Observability, Incident Response, plus the AI-powered Grafana Assistant. Get started with our generous free tier today.
Create free account
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of gorilla/handlers!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Go

Registered

2023-01-30