realip

package module
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 8 Imported by: 0

README

realip for Caddy v2

This repo is a port of captncraig's "realip" module to Caddy v2. See original plugin below:

https://github.com/captncraig/caddy-realip

Syntax

realip {
    header name
    from cidr 
    maxhops #
    strict
}

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.

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.

Example

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

realip {
  header "X-Forwarded-For"
  from cloudflare
  maxhops 5
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL