diff --git a/functions.php b/functions.php
index 2b99659fde4707ee1876b015ca45c6e47b761b34..b00aff3f51f69e754f238dc9989f735a0ec7d603 100644
--- a/functions.php
+++ b/functions.php
@@ -1,5 +1,7 @@
 <?php
 
+if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { $_SERVER['HTTPS'] = 'on'; }
+
 //include __DIR__. "/baselinker_functions.php";
 
 if ( file_exists( __DIR__. '/functions_add.php' ) ) {