1Mojolicious::Plugin::HeUasdeerrCCoonndtirtiibount(e3d)PMeorjlolDiocciuomuesn:t:aPtliuognin::HeaderCondition(3)
2
3
4

NAME

6       Mojolicious::Plugin::HeaderCondition - Header condition plugin
7

SYNOPSIS

9         # Mojolicious
10         $app->plugin('HeaderCondition');
11         $app->routes->get('/foo')->requires(headers => {Referer => qr/example\.com/});
12
13         # Mojolicious::Lite
14         plugin 'HeaderCondition';
15         get '/' => (headers => {Referer => qr/example\.com/}) => sub {...};
16
17         # All headers need to match
18         $app->routes->get('/foo')->requires(headers => {
19           'X-Secret-Header' => 'Foo',
20           Referer => qr/example\.com/
21         });
22
23         # The "agent" condition is a shortcut for the "User-Agent" header
24         get '/' => (agent => qr/Firefox/) => sub {...};
25
26         # The "host" condition is a shortcut for the detected host
27         get '/' => (host => qr/mojolicious\.org/) => sub {...};
28

DESCRIPTION

30       Mojolicious::Plugin::HeaderCondition is a route condition for header-
31       based routes.
32
33       This is a core plugin, that means it is always enabled and its code a
34       good example for learning to build new plugins, you're welcome to fork
35       it.
36
37       See "PLUGINS" in Mojolicious::Plugins for a list of plugins that are
38       available by default.
39

METHODS

41       Mojolicious::Plugin::HeaderCondition inherits all methods from
42       Mojolicious::Plugin and implements the following new ones.
43
44   register
45         $plugin->register(Mojolicious->new);
46
47       Register conditions in Mojolicious application.
48

SEE ALSO

50       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
51
52
53
54perl v5.32.1                      2021-0M2o-j0o7licious::Plugin::HeaderCondition(3)
Impressum