redirects_traefik_middleware

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

TRIMM Redirects Traefik Middleware

Introduction

This plugin is a Traefik middleware written in Go Lang. The purpose of it is to redirect the user according to rules processed from the Central API backend.

Traefik Configuration

Static
traefik.yml
experimental:
  plugins:
    redirects-traefik-middleware:
      moduleName: github.com/TRIMM/redirects-traefik-middleware
      version: "v0.2.0"
Dynamic
http.yml
http:
  routers:
    my-router:
      rule: host(`demo.localhost`)
      service: service-foo
      entryPoints:
        web:
        address: ":80"
      middlewares:
        - redirects-traefik-middleware

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

  middlewares:
    redirects-traefik-middleware:
      plugin:
        redirects-traefik-middleware:
          redirectsAppURL: "redirects-app:8081"

Documentation

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)

Types

type Config

type Config struct {
	RedirectsAppURL string `json:"redirectsAppURL,omitempty"`
}

func CreateConfig

func CreateConfig() *Config

type RedirectsPlugin

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

func (*RedirectsPlugin) ServeHTTP

func (rp *RedirectsPlugin) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP intercepts a request and matches it against the existing rules If a match is found, it redirects accordingly

Directories

Path Synopsis
api
v1
internal
app
pkg

Jump to

Keyboard shortcuts

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