Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conditional matching on hostname not supported anymore? #1226

Open
danmichaelo opened this issue Oct 20, 2020 · 0 comments
Open

Conditional matching on hostname not supported anymore? #1226

danmichaelo opened this issue Oct 20, 2020 · 0 comments

Comments

@danmichaelo
Copy link

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant