Commit 847c035c authored by Luc Didry's avatar Luc Didry

Handle empty but defined allowed_domains and fixed_domain

parent 602559e1
Pipeline #10492 passed with stage
in 4 minutes and 57 seconds
......@@ -124,7 +124,7 @@ sub startup {
my $prefix = $c->url_for('index')->to_abs;
# Forced domain
$prefix->host($c->config('fixed_domain')) if (defined($c->config('fixed_domain')));
$prefix->host($c->config('fixed_domain')) if (defined($c->config('fixed_domain')) && $c->config('fixed_domain') ne '');
# Hack for prefix (subdir) handling
$prefix .= '/' unless ($prefix =~ m#/$#);
return $prefix;
......@@ -198,7 +198,7 @@ sub startup {
my $c = shift;
# API allowed domains
if (defined($c->config('allowed_domains'))) {
if (defined($c->config('allowed_domains')) && scalar @{$c->config('allowed_domains')}) {
if ($c->config('allowed_domains')->[0] eq '*') {
$c->res->headers->header('Access-Control-Allow-Origin' => '*');
} elsif (my $origin = $c->req->headers->origin) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment