项目作者: carnage-sh

项目描述 :
A Traefik middleware that maps sessions to custom properties
高级语言: Go
项目地址: git://github.com/carnage-sh/sessionmapper.git
创建时间: 2021-03-28T12:29:17Z
项目社区:https://github.com/carnage-sh/sessionmapper

开源协议:BSD 3-Clause "New" or "Revised" License

下载


" class="reference-link">SessionMapper GitHub branch checks state

SessionMapper adds properties to your requests based on custom logic.
To perform its task, it connects to a Mapping Server that matches sessions to
users, groups, roles, experiments, preferences, tracing properties or whatever
is needed to provide advanced server-side routing capabilities.

Overview

The SessionMapper middleware for Traefik queries an API and set additional
headers before it runs upstream requests. The middleware can be used in front
of others. It allows advanced behaviors and applications are limitless… The
principle is shown below:

overview

SessionMapper can easily be used and adapted for A/B testing, canary
deployment, role-based security, advanced tracing, test collection,
personalization…

Configuration

You only need a few parameters to configure the middleware:

  • headers lists the headers to capture from the request and send to the
    server (default: me)
  • server is the server URL (default: http://localhost:7777/)
  • timeout is the delay in milliseconds before the request to the server
    fails and no headers are set to the upstream request.

Implementing a SessionMapper Server

For now, the session Mapper is a simple HTTP server that should be
colocated to traefik, for instance as a sidecar. The middleware performs
a POST to the server URL. The return message would look like below:

  1. {"upstream": {
  2. "key1": "value1",
  3. "key2": "value2"
  4. }}

The server directory that is part of the
carnage-sh/sessionmapper provides
a simple service that implements the current request/response protocol. Next
release will improve the protocol to reduce the latency and make it more
reliable, including blocking on failure. Do not hesitate to open an issue if
you repository find this plugin useful and want to support more advanced
scenarios.