Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
058ff948
Commit
058ff948
authored
Mar 28, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better middleware godoc, fixed ordering too
parent
9378f383
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
config/middleware.go
config/middleware.go
+23
-5
No files found.
config/middleware.go
View file @
058ff948
...
...
@@ -3,6 +3,7 @@ package config
import
(
"github.com/mholt/caddy/middleware"
"github.com/mholt/caddy/middleware/browse"
"github.com/mholt/caddy/middleware/errors"
"github.com/mholt/caddy/middleware/extensionless"
"github.com/mholt/caddy/middleware/fastcgi"
"github.com/mholt/caddy/middleware/gzip"
...
...
@@ -15,14 +16,31 @@ import (
"github.com/mholt/caddy/middleware/websockets"
)
// This init function registers middleware. Register middleware
// in the order they should be executed during a request.
// Middleware execute in this order: A-B-C-*-C-B-A
// assuming they call the Next handler in the chain.
// This init function registers middleware. Register
// middleware in the order they should be executed
// during a request (A, B, C...). Middleware execute
// in the order A-B-C-*-C-B-A, assuming they call
// the Next handler in the chain.
//
// Note: Ordering is VERY important. Every middleware
// will feel the effects of all other middleware below
// (after) them, but must not care what middleware above
// them are doing.
//
// For example, log needs to know the status code and exactly
// how many bytes were written to the client, which every
// other middleware can affect, so it gets registered first.
// The errors middleware does not care if gzip or log modifies
// its response, so it gets registered below them. Gzip, on the
// other hand, DOES care what errors does to the response since
// it must compress every output to the client, even error pages,
// so it must be registered before the errors middleware and any
// others that would write to the response.
func
init
()
{
register
(
"log"
,
log
.
New
)
register
(
"gzip"
,
gzip
.
New
)
register
(
"errors"
,
errors
.
New
)
register
(
"header"
,
headers
.
New
)
register
(
"log"
,
log
.
New
)
register
(
"rewrite"
,
rewrite
.
New
)
register
(
"redirect"
,
redirect
.
New
)
register
(
"ext"
,
extensionless
.
New
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment