The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Plack::App::XAO - XAO adapter for Plack

SYNOPSIS

In a psgi file with Builder:

    builder {
        mount '/' => Plack::App::XAO->new(site => 'example')->to_app(),
    }

From a command line:

    plackup -MPlack::App::XAO -e'Plack::App::XAO->new(site => 'example')->to_app()'

DESCRIPTION

This is a simple adapter allowing to run a XAO::Web web site with Plack and the multitude of servers that support PSGI interface.

To serve static files either mount them with builder:

    builder {
        mount '/images' => Plack::App::File->new(root => '/path/to/images')->to_app;
        mount '/' => Plack::App::XAO->new(site => 'example')->to_app(),
    };

Or, better yet, just use the same 'maptodir' configuration that Apache::XAO module uses:

    path_mapping_table => {
        '/images' => {
            type        => 'maptodir',
            max_age     => 7*24*3600,
        },
    },

That has a benefit of automatically prepending images with the site home directory path, whatever it happens to be.

Fake HTTPS

It is useful sometimes to let the code think it's running in HTTPS environment, when in reality it is not -- for instance if there is an immediate HTTPS proxy and there is no point in encrypting twice.

Use 'fake_https' parameter to achieve that:

    mount '/' => Plack::App::XAO->new(
        site        => 'example'
        fake_https  => 1,
    )->to_app(),

EXPORTS

Nothing.

AUTHOR

Copyright (c) 2018 Andrew Maltsev

<am@ejelta.com> -- http://ejelta.com/xao/

SEE ALSO

XAO::Web::Intro XAO::Web XAO::DO::Config