traefik_sorrypage

package module
v0.0.0-...-3a63dea Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 5 Imported by: 0

README

Traefik SorryPage Middleware Plugin

This Traefik middleware plugin allows you to configure sorrypage responses for your routers.

SorryPage mode will be triggered if enabled is set to true and if the file configured for triggerFilename exists.

Static Configuration

FILE
experimental:
  plugins:
    traefik-sorrypage:
      moduleName: github.com/joaquinbejar/traefik-sorrypage
      version: v0.1.0
CLI
--experimental.plugins.traefik-sorrypage.modulename=github.com/joaquinbejar/traefik-sorrypage
--experimental.plugins.traefik-sorrypage.version=v0.1.0

Dynamic Configuration

FILE
http:
  services:
    service1:
      loadBalancer:
        servers:
          - url: "http://service1:8080/"
    service2:
      loadBalancer:
        servers:
          - url: "http://service2:8081/"
    sorrypage:
      loadBalancer:
        servers:
          - url: "http://sorrypage:80/"         
            
  routers:
    service1-router:
      rule: "Host(`service1`)"
      service: "service1"
      middlewares:
        - sorrypage
    service2-router:
      rule: "Host(`service2`)"
      service: "service2"
      middlewares:
        - sorrypage
    sorrypage-router:
      rule: "Host(`sorrypage`)"
      service: "sorrypage"

  middlewares:
    sorrypage:
      plugin:
        traefik-sorrypage:
          enabled: true
          RedirectService: 'sorrypage'

Author

Joaquín Béjar García

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Overview

Package traefik_sorrypage a sorrypage page plugin.

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 SorryPage plugin.

Types

type Config

type Config struct {
	Enabled         bool   `json:"enabled"`
	RedirectService string `json:"redirectService"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type SorryPage

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

SorryPage a sorrypage page plugin.

func (*SorryPage) ServeHTTP

func (a *SorryPage) 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