Middleware for REST API
- Ping
- PanicRecovery
- Authentication via header
- Authentication via Bearer token
- Authentication via JWT token
- BasicAuth
- RealIP
- SizeLimit
Ping middleware is a simple middleware that returns a 200 OK response.
Authentication is a middleware that checks for a header with a given name and value.
AuthenticationJWT is a middleware that checks for a JWT token in the Authorization header.
AuthenticationBearer is a middleware that checks for a bearer token in the Authorization header.
BasicAuth middleware checks for a username and password in the request's Authorization header.
SizeLimit middleware checks if body size is above the limit and returns StatusRequestEntityTooLarge (413)
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing either the X-Forwarded-For or X-Real-IP headers.