NAME

Plack::Middleware::CrossOrigin - Adds headers to allow Cross-Origin Resource Sharing

VERSION

version 0.001

SYNOPSIS

builder {
    enable 'CrossOrigin',
        origins => '*', methods => ['GET', 'POST'], max_age => 60*60*24*30;
    $app;
};

DESCRIPTION

Adds Cross Origin Request Sharing headers used by recent browsers to allow XMLHttpRequests across domains.

METHODS

cors_headers ( $env )

Returns a list of headers to add for a CORS request given the request and the configuration.

CONFIGURATION

origins

A list of allowed origins. '*' can be specified to allow access from any origin.

headers

A list of allowed headers. '*' can be specified to allow any headers.

methods

A list of allowed methods. '*' can be specified to allow any methods.

max_age

The max length in seconds to cache the response data for.

expose_headers

A list of allowed headers to expose to the client.

credentials

Whether the resource supports credentials.

SEE ALSO

AUTHOR

Graham Knop <haarg@haarg.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Graham Knop.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.