traefik_request_filter

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

traefik-request-filter

WIP

Configuration

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

# Static configuration

experimental:
  plugins:
    traefik-request-filter:
      moduleName: github.com/0xanonymeow/traefik-request-filter
      version: v0.1.0

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:
        - requestFilter@docker

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

  middlewares:
    requestFilter:
      plugin:
        traefik-request-filter:
          headers:
            X-Foo: bar
            X-Bar: baz,qux;quux
          query:
            foo: bar
            bar: baz,qux;quux
          body:
            # regex: ^foo$
            json:
              foo: bar
              bar: true
              baz: 100
              qux:
                - quux
                - true
                - 100

Documentation

Overview

Package traefik_request_filter Filter your Traefik request headers, query parameters, and body.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New created a new request filter plugin.

Types

type Config

type Config struct {
	Headers map[string]string
	Query   map[string]string
	Body    body
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type RequestFilter

type RequestFilter struct {
	// contains filtered or unexported fields
}

RequestFilter a traefik_request_filter plugin.

func (*RequestFilter) ServeHTTP

func (rf *RequestFilter) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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