Fix HTTP redirects when running under HTTP/S

This commit is contained in:
Oliver Gorwits
2013-10-24 05:55:19 +01:00
parent d1f3b89f43
commit e444efb004
4 changed files with 18 additions and 7 deletions

View File

@@ -66,7 +66,8 @@ get '/search' => require_login sub {
if (not param('tab')) {
if (not $q) {
return redirect uri_for('/')->path;
header(Location => uri_for('/')->path);
return status(302);
}
# pick most likely tab for initial results
@@ -79,11 +80,12 @@ get '/search' => require_login sub {
if ($nd and $nd->count) {
if ($nd->count == 1) {
# redirect to device details for the one device
return redirect uri_for('/device', {
header(Location => uri_for('/device', {
tab => 'details',
q => ($nd->first->dns || $nd->first->ip),
f => '',
})->path_query;
})->path_query);
return status(302);
}
# multiple devices