iris/middleware
Gerasimos (Makis) Maropoulos 66e3c26efe
new app.MiddlewareExists method
2024-01-21 17:16:59 +02:00
..
accesslog minor improvements 2024-01-20 20:32:56 +02:00
basicauth fix #2158 and more 2023-07-08 02:08:18 +03:00
cors replace ioutil with io package and other minor improvements 2022-06-17 22:03:18 +03:00
grpc replace ioutil with io package and other minor improvements 2022-06-17 22:03:18 +03:00
hcaptcha update _examples dependencies 2023-11-01 19:31:17 +02:00
jwt update _examples dependencies 2023-11-01 19:31:17 +02:00
logger add accesslog middleware (rel: #1601) 2020-09-06 10:38:48 +03:00
methodoverride fix #2158 and more 2023-07-08 02:08:18 +03:00
modrevision replace ioutil with io package and other minor improvements 2022-06-17 22:03:18 +03:00
monitor publish v12.2.0-alpha6 2022-02-18 22:19:33 +02:00
pprof replace ioutil with io package and other minor improvements 2022-06-17 22:03:18 +03:00
rate (#1554) Add support for all common compressions (write and read) 2020-07-10 23:21:09 +03:00
recaptcha add remoteip and sitekey optional fields to hcaptcha middleware 2022-09-19 14:39:23 +03:00
recover new app.MiddlewareExists method 2024-01-21 17:16:59 +02:00
requestid Improve middleware/requestid test suite (#2191) 2023-08-21 20:12:54 +03:00
rewrite rename master branch to main 2023-08-20 03:12:46 +03:00
README.md rename master branch to main 2023-08-20 03:12:46 +03:00

Builtin Handlers

Middleware Example
rewrite iris/_examples/routing/rewrite
basic authentication iris/_examples/auth/basicauth
request logger iris/_examples/logging/request-logger
HTTP method override iris/middleware/methodoverride/methodoverride_test.go
profiling (pprof) iris/_examples/pprof
Google reCAPTCHA iris/_examples/auth/recaptcha
hCaptcha iris/_examples/auth/recaptcha
recovery iris/_examples/recover
rate iris/_examples/request-ratelimit
jwt iris/_examples/auth/jwt
requestid iris/middleware/requestid/requestid_test.go

Community made

Most of the experimental handlers are ported to work with iris's handler form, from third-party sources.

Middleware Description Example
pg Middleware that provides easy and type-safe access to PostgreSQL database iris-contrib/middleware/pg/_examples
jwt Middleware checks for a JWT on the Authorization header on incoming requests and decodes it iris-contrib/middleware/jwt/_example
cors HTTP Access Control iris-contrib/middleware/cors/_example
secure Middleware that implements a few quick security wins iris-contrib/middleware/secure/_example
tollbooth Generic middleware to rate-limit HTTP requests iris-contrib/middleware/tollboothic/_examples/limit-handler
cloudwatch AWS cloudwatch metrics middleware iris-contrib/middleware/cloudwatch/_example
new relic Official New Relic Go Agent iris-contrib/middleware/newrelic/_example
prometheus Easily create metrics endpoint for the prometheus instrumentation tool iris-contrib/middleware/prometheus/_example
casbin An authorization library that supports access control models like ACL, RBAC, ABAC iris-contrib/middleware/casbin/_examples
sentry-go (ex. raven) Sentry client in Go sentry-go/example/iris
csrf Cross-Site Request Forgery Protection iris-contrib/middleware/csrf/_example
throttler Rate limiting access to HTTP endpoints iris-contrib/middleware/throttler/_example

Third-Party Handlers

Iris has its own middleware form of func(ctx iris.Context) but it's also compatible with all net/http middleware forms. See here.

Here's a small list of useful third-party handlers:

Middleware Description
goth OAuth, OAuth2 authentication. Example
permissions2 Cookies, users and permissions. Example
csp Content Security Policy (CSP) support
delay Add delays/latency to endpoints. Useful when testing effects of high latency
onthefly Generate TinySVG, HTML and CSS on the fly
RestGate Secure authentication for REST API endpoints
stats Store information about your web application (response time, etc.)
VanGoH Configurable AWS-Style HMAC authentication middleware
digits Middleware that handles Twitter Digits authentication

Feel free to put up your own middleware in this list!