Custom middleware with any language? Yes!

Hi there!

First version of the middleware 'Bridge' was released.

https://pilot.traefik.io/plugins/275939441741136402/bridge

This middleware can send requests to your services, modify the original request and interrupt it!

A small example for custom middleware with PHP and Laravel framework.

Add to routes/api.php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Route::post('/auth', function (Request $request) {

    $response = [
        '2' => [
            'X-Foo' => 'Bar',
        ],
    ];

    return response()->json($response);
});

Run the Laravel application

php artisan serve --port 8008

Add middleware Bridge to your Traefik configuration with options:

address: 'http://127.0.0.1:8008/api/auth'

Call the Traefik (in my case the Traefik listen :8000 port)

curl -v http://localhost:8000

See to response headers


< X-Foo: Bar
...

It works! )

More documentation on the plugin page https://pilot.traefik.io/plugins/275939441741136402/bridge

Any examples of writing plugins in say, lua, or powershell?

Ok) With any language, which can start http server. And lua, for example, can do it)