Kustvakt now requires absolute redirect URIs
Change-Id: I034a68abfca6f0367dd3972362d3fa84311774d0
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 98a3299..d6623d5 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -169,10 +169,14 @@
$self->hook(
before_dispatch => sub {
my $c = shift;
- if (my $host = $c->req->headers->header('X-Forwarded-Host')) {
+ my $h = $c->req->headers;
+ if (my $host = $h->header('X-Forwarded-Host')) {
+
+ my $proto = $h->header('X-Forwarded-Proto') // ($conf->{https_only} ? 'https' : undef);
+
foreach ($c->req->url->base) {
$_->host($host);
- $_->scheme(undef);
+ $_->scheme($proto);
$_->port(undef);
};
};