mirror of
https://github.com/caddyserver/caddy.git
synced 2025-08-07 09:04:04 -04:00
Add log handler
parent
1975625232
commit
b26996ce4d
@ -79,19 +79,20 @@ This page describes how to use Caddy 2, which is a work-in-progress on the [v2 b
|
|||||||
- [http/servers/handle](#httpservershandle)
|
- [http/servers/handle](#httpservershandle)
|
||||||
- Middleware (non-terminating handlers):
|
- Middleware (non-terminating handlers):
|
||||||
- [http.handlers.headers](#httphandlersheaders)
|
- [http.handlers.headers](#httphandlersheaders)
|
||||||
|
- [http.handlers.headers](#httphandlerslog)
|
||||||
- [http.handlers.rewrite](#httphandlersrewrite)
|
- [http.handlers.rewrite](#httphandlersrewrite)
|
||||||
- [http.handlers.markdown](#httphandlersmarkdown)
|
- [http.handlers.markdown](#httphandlersmarkdown)
|
||||||
- [http.handlers.authentication](#httphandlersauthentication)
|
- [http.handlers.authentication](#httphandlersauthentication)
|
||||||
- [http.handlers.request_body](#httphandlersrequest_body)
|
- [http.handlers.request_body](#httphandlersrequest_body)
|
||||||
- [http.handlers.encode](#httphandlersencode)
|
- [http.handlers.encode](#httphandlersencode)
|
||||||
- [http.handlers.templates](#httphandlerstemplates)
|
- [http.handlers.templates](#httphandlerstemplates)
|
||||||
|
- [http.handlers.vars](#httphandlersvars)
|
||||||
- Terminating handlers:
|
- Terminating handlers:
|
||||||
- [http.handlers.static_response](#httphandlersstatic_response)
|
- [http.handlers.static_response](#httphandlersstatic_response)
|
||||||
- [http.handlers.file_server](#httphandlersfile_server)
|
- [http.handlers.file_server](#httphandlersfile_server)
|
||||||
- [http.handlers.reverse_proxy](#httphandlersreverse_proxy)
|
- [http.handlers.reverse_proxy](#httphandlersreverse_proxy)
|
||||||
- [http.handlers.subroute](#httphandlerssubroute)
|
- [http.handlers.subroute](#httphandlerssubroute)
|
||||||
- [http.handlers.error](#httphandlerserror)
|
- [http.handlers.error](#httphandlerserror)
|
||||||
- [http.handlers.vars](#httphandlersvars)
|
|
||||||
- [http/servers/errors](#httpserverserrors)
|
- [http/servers/errors](#httpserverserrors)
|
||||||
- [http/servers/tls_connection_policies](#httpserverstls_connection_policies)
|
- [http/servers/tls_connection_policies](#httpserverstls_connection_policies)
|
||||||
- [tls.certificate_selection.custom](#tlscertificate_selectioncustom)
|
- [tls.certificate_selection.custom](#tlscertificate_selectioncustom)
|
||||||
@ -1582,9 +1583,23 @@ Response header operations can be conditioned upon response status code and/or o
|
|||||||
- `response.require.headers`: Apply response header changes if the given response headers have the given value(s).
|
- `response.require.headers`: Apply response header changes if the given response headers have the given value(s).
|
||||||
|
|
||||||
|
|
||||||
|
##### http.handlers.log
|
||||||
|
|
||||||
|
Logs the HTTP request.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"handler": "log",
|
||||||
|
"logger_name": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- `logger_name`: An optional name to give this logger. By default, each Caddy module has its own logger named the same as its module. This name will be appended to this logger which can be used to differentiate it from other log handlers, which is useful when including or excluding loggers from specific logs you have defined.
|
||||||
|
|
||||||
|
|
||||||
##### http.handlers.rewrite
|
##### http.handlers.rewrite
|
||||||
|
|
||||||
Changes the request's URI or method.
|
Changes the request's URI or method. May also optionally issue a redirect for convenience if the URI is changed.
|
||||||
|
|
||||||
Properties in this module accept placeholders.
|
Properties in this module accept placeholders.
|
||||||
|
|
||||||
@ -1724,6 +1739,18 @@ Interprets the response as a template body, then executes the template and write
|
|||||||
See [all available template actions](https://github.com/caddyserver/caddy/wiki/v2:-Templates).
|
See [all available template actions](https://github.com/caddyserver/caddy/wiki/v2:-Templates).
|
||||||
|
|
||||||
|
|
||||||
|
##### http.handlers.vars
|
||||||
|
|
||||||
|
Sets variables associated with the request that can be used later with placeholders: `{http.vars.variable_name}`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"handler": "vars",
|
||||||
|
"variable_name": "value"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
##### http.handlers.static_response
|
##### http.handlers.static_response
|
||||||
|
|
||||||
Responds to the request with a static (hard-coded) response. Does not call the next handler in the chain.
|
Responds to the request with a static (hard-coded) response. Does not call the next handler in the chain.
|
||||||
@ -2074,17 +2101,6 @@ Since this handler does not write a response, the error information is for use b
|
|||||||
- `error`: The error message. Optional. Default is no error message.
|
- `error`: The error message. Optional. Default is no error message.
|
||||||
|
|
||||||
|
|
||||||
##### http.handlers.vars
|
|
||||||
|
|
||||||
Sets variables associated with the request that can be used later with placeholders: `{http.vars.variable_name}`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"handler": "vars",
|
|
||||||
"variable_name": "value"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### http/servers/errors
|
#### http/servers/errors
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user