Issue #1615368 by tomfriedhof, drozas: Solves the issue related to work with https. Changes based on the adaptation of the patch provided for D7 version