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

DESCRIPTION

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

METHODS

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

SEE ALSO

51       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
52
53
54
55perl v5.28.0                      2018-0M5o-j0o8licious::Plugin::HeaderCondition(3)
Impressum