Skip to content

Conditional matching on hostname not supported anymore? #1226

Description

@danmichaelo

Hi. According to https://metacpan.org/pod/Dancer::Introduction#CONDITIONAL-MATCHING , "Routes may include some matching conditions (on the useragent and the hostname at the moment)". but I did not get this to work:

get '/hello', {host => 'example.com'} => sub {
    return "Hello world\n";
};

The error I got was this one:

raise core_route => "Not a valid option for route matching: `$opt'"

and the list of valid options seems to be taken from these lists:

my @http_env_keys = (
'user_agent', 'accept_language', 'accept_charset',
'accept_encoding', 'keep_alive', 'connection', 'accept',
'accept_type', 'referer', #'host', managed manually
);
my $count = 0;
__PACKAGE__->attributes(
# query
'env', 'path', 'method',
'content_type', 'content_length',
'id',
'uploads', 'headers', 'path_info',
'ajax', 'is_forward',
@http_env_keys,
);

where 'host' has been commented out. Does this mean conditional matching on hostname is no longer supported? Is there an easy way to bring back support for it? Unfortunately, I'm a bit of a novice when it comes to Perl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions