traefik_session_max_age

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

This repository includes traefik plugin which sets sticky session cookie's max age.

Configuration

For traefik plugin, 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

experimental:
  plugins:
    session-max-age:
      moduleName: github.com/longbridgeapp/traefik-session-max-age
      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:
        - session-max-age

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

  middlewares:
    session-max-age:
      plugin:
        session-max-age:
          cookieName: traefik_cookie
          maxAge: 100000

Documentation

Overview

Package traefik_session_max_age is a plugin for the Traefik reverse proxy that sets cookie's max-age

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 return a wrapped http.Handler.

Types

type Config

type Config struct {
	CookieName string `json:"cookieName,omitempty"`
	MaxAge     int    `json:"maxAge,omitempty"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type SessionMaxAge

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

SessionMaxAge is a middleware for traefik middlware plugin to set cookie max age.

func (*SessionMaxAge) ServeHTTP

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