This page is about Caddy 1 and will stay here forever.

User Guide


Caddy-authz is an authorization middleware for Caddy, it's based on Casbin is a powerful and efficient open-source access control library for Golang projects. It provides support for enforcing authorization based on various models like ACL, RBAC, ABAC.

Full documentation


Simple Example
package main import ( "net/http" "" "" "" ) func main() { // load the casbin model and policy from files, database is also supported. e := casbin.NewEnforcer("authz_model.conf", "authz_policy.csv") // define your handler, this is just an example to return HTTP 200 for any requests. // the access that is denied by authz will return HTTP 403 error. handler := authz.Authorizer{ Next: httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) { return http.StatusOK, nil }), Enforcer: e, } }

Use a simple model file and policy file to do the authorization for the HTTP requests.

Related Links

Access the full documentation for this plugin off-site:

Plugin Help

Get help from the maintainers of the http.authz plugin:

Plugin Website

Visit http.authz's website for more information:

Plugin Author: hsluoyz
Last Updated: 27 May 2017, 6:52 AM
This plugin is independent of the Caddy project and is not endorsed or maintained by Caddy developers. Use at your own risk. Do not file issues for this plugin on Caddy's bug tracker.