Skip to content

Commit

Permalink
improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sarge committed Mar 27, 2022
1 parent 3e0060e commit 7a3ab2f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,34 @@ https://github.com/captncraig/caddy-realip

## Syntax
```Caddyfile
# tell caddy to process realip before other plugins
order realip first
realip {
header name
from cidr
from cidr
maxhops #
strict
}
```
name is the name of the header containing the actual IP address. recommended value is "X-Forwarded-For".
`name` is the name of the header containing the actual IP address. recommended value is "X-Forwarded-For".

cidr is the address range of expected proxy servers. As a security measure, IP headers are only accepted from known proxy servers. Must be a valid cidr block notation. This may be specified multiple times. "cloudflare" is an acceptable preset.
`cidr` is the address range of expected proxy servers. As a security measure, IP headers are only accepted from known proxy servers. Must be a valid cidr block notation. This may be specified multiple times. `cloudflare` and `cloudfront` are currently supported.

maxhops specifies a limiting number of forwards if using "X-Forwarded-For" or similar headers as the identifier. recommended value is 5.
`maxhops` specifies a limiting number of forwards if using "X-Forwarded-For" or similar headers as the identifier. Recommended value is 5.

strict, if specified, will reject requests from unkown proxy IPs with a 403 status. If not specified, it will simply leave the original IP in place.
`strict`, if specified, will reject requests from unkown proxy IPs with a 403 status. If not specified, it will simply leave the original IP in place.

## Example

Simple usage to read `X-Forwarded-For` from cloudflare:

```Caddyfile
# tell caddy to process realip before other plugins
order realip first
realip {
header "X-Forwarded-For"
from cloudflare
Expand Down

0 comments on commit 7a3ab2f

Please sign in to comment.