tomMoulard / xrealip

WIP !!! A X-Real-IP plugin to match nginx behavior

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xrealip

A Traefik middleware plugins developed using the Go language.

The goal is to match the behavior of X-Real-Ip of nginx.

Usage

Configuration

For each plugin, the Traefik static configuration must define the module name (as is usual for Go packages).

The following declaration (given here in YAML) defines a plugin:

# Static configuration
pilot:
  token: xxxxx

experimental:
  plugins:
    xrealip:
      moduleName: github.com/tommoulard/xrealip
      version: v0.0.1

Here is an example of a file provider dynamic configuration (given here in YAML), where the interesting part is the http.middlewares section:

# Dynamic configuration

http:
  routers:
    my-router:
      rule: host(`demo.localhost`)
      service: service-foo
      entryPoints:
        - web
      middlewares:
        - xrealip

  services:
   service-foo:
      loadBalancer:
        servers:
          - url: http://127.0.0.1:5000

  middlewares:
    xrealip:
      plugin:
        xrealip:
          from:
             - 127.0.0.1
          header: Cf-Connecting-Ip
          resursive: true

The configuration matches the one given by nginx itself:

  • from is equivalent as set_real_ip_from
  • header is equivalent as real_ip_header (default X-Forwarded-For)
  • recursive is equivalent as real_ip_recursive

You can find a more in depth configuration description on the nginx doc itself.

Build Status

About

WIP !!! A X-Real-IP plugin to match nginx behavior

License:Apache License 2.0


Languages

Language:Go 97.9%Language:Makefile 2.1%