File: Traefik.pm

package info (click to toggle)
lemonldap-ng 2.16.1%2Bds-deb12u6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 27,364 kB
  • sloc: perl: 65,855; javascript: 12,430; xml: 6,336; makefile: 1,228; sh: 470; python: 51; php: 26; sql: 5
file content (38 lines) | stat: -rw-r--r-- 868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package Lemonldap::NG::Handler::Server::Traefik;

use strict;
use Mouse;
use Lemonldap::NG::Handler::Server::Main;

our $VERSION = '2.0.6';

extends 'Lemonldap::NG::Handler::PSGI';

sub init {
    my $self = shift;
    $self->api('Lemonldap::NG::Handler::Server::Main');
    my $tmp = $self->SUPER::init(@_);
}

sub _run {
    my $self = shift;
    return sub {
        my $req = $_[0];
        $req->{HTTP_HOST}   = $req->{HTTP_X_FORWARDED_HOST};
        $req->{REQUEST_URI} = $req->{HTTP_X_FORWARDED_URI};
        return $self->_logAuthTrace(
            Lemonldap::NG::Common::PSGI::Request->new($req) );
    }
}

sub handler {
    my ( $self, $req ) = @_;
    my @convertedHdrs = (
        @{ $req->{respHeaders} },
        'Content-Length' => 0,
        Cookie           => ( $req->env->{HTTP_COOKIE} // '' )
    );
    return [ 200, \@convertedHdrs, [] ];
}

1;