gorilla / Handlers
Licence: bsd-2-clause
A collection of useful middleware for Go HTTP services & web applications 🛃
Stars: ✭ 1,174
Programming Languages
go
31211 projects - #10 most used programming language
Projects that are alternatives of or similar to Handlers
Go Httpwares
Go HTTP Server Middleware and Client Tripperware
Stars: ✭ 60 (-94.89%)
Mutual labels: middleware, handler
Middleware
Community Middleware List for the Iris Web Framework.
Stars: ✭ 188 (-83.99%)
Mutual labels: middleware, handler
Dotweb
Simple and easy go web micro framework
Stars: ✭ 1,354 (+15.33%)
Mutual labels: middleware, handler
Alice
Painless middleware chaining for Go
Stars: ✭ 2,438 (+107.67%)
Mutual labels: middleware, handler
Msngr.js
An asynchronous messaging library, written in JavaScript, for node and the web browser
Stars: ✭ 337 (-71.29%)
Mutual labels: middleware, handler
Csrf
gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services 🔒
Stars: ✭ 631 (-46.25%)
Mutual labels: middleware, gorilla
Mux
A powerful HTTP router and URL matcher for building Go web servers with 🦍
Stars: ✭ 15,667 (+1234.5%)
Mutual labels: middleware, gorilla
AspNetCore.Weixin
An ASP.NET Core middleware for Wechat/Weixin message handling and apis. (微信公众平台/接口调用服务)
Stars: ✭ 24 (-97.96%)
Mutual labels: middleware, handler
Nex
Aiming to simplify the construction of JSON API service
Stars: ✭ 35 (-97.02%)
Mutual labels: middleware, handler
Laravel Remember Uploads
Laravel Middleware and helper for remembering file uploads during validation redirects
Stars: ✭ 67 (-94.29%)
Mutual labels: middleware
Oauth
OAuth 2.0 Authorization Server & Authorization Middleware for Gin-Gonic
Stars: ✭ 61 (-94.8%)
Mutual labels: middleware
Atom Message Panel
An easy way to display your messages in Atom
Stars: ✭ 60 (-94.89%)
Mutual labels: handler
Express Joi Validation
validate express application inputs and parameters using joi
Stars: ✭ 70 (-94.04%)
Mutual labels: middleware
Pgstore
A Postgres session store backend for gorilla/sessions
Stars: ✭ 66 (-94.38%)
Mutual labels: gorilla
Helmet
Help secure Express apps with various HTTP headers
Stars: ✭ 8,648 (+636.63%)
Mutual labels: middleware
Http Proxy Middleware
⚡ The one-liner node.js http-proxy middleware for connect, express and browser-sync
Stars: ✭ 8,730 (+643.61%)
Mutual labels: middleware
gorilla/handlers
Package handlers is a collection of handlers (aka "HTTP middleware") for use
with Go's net/http
package (or any framework supporting http.Handler
), including:
- 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.
- CompressHandler 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
andr.URL.Scheme
based on theX-Forwarded-For
,X-Real-IP
,X-Forwarded-Proto
and RFC7239Forwarded
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).
- RecoveryHandler for recovering from unexpected panics.
Other handlers are documented on the Gorilla website.
Example
A simple example using handlers.LoggingHandler
and handlers.CompressHandler
:
import (
"net/http"
"github.com/gorilla/handlers"
)
func main() {
r := http.NewServeMux()
// Only log requests to our admin dashboard to stdout
r.Handle("/admin", handlers.LoggingHandler(os.Stdout, http.HandlerFunc(ShowAdminDashboard)))
r.HandleFunc("/", ShowIndex)
// Wrap our server with our gzip handler to gzip compress all responses.
http.ListenAndServe(":8000", handlers.CompressHandler(r))
}
License
BSD licensed. See the included LICENSE file for details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].