Browse Source

Improve protocol detection

Sunny 2 years ago
parent
commit
12f382475e
1 changed files with 7 additions and 1 deletions
  1. 7 1
      utilities/link.php

+ 7 - 1
utilities/link.php

@@ -1,6 +1,12 @@
 <?php
   function convert_link($link) {
-    $scheme = $_SERVER["REQUEST_SCHEME"];
+    if ($_SERVER["REQUEST_SCHEME"])
+      $scheme = $_SERVER["REQUEST_SCHEME"];
+    elseif ($_SERVER["HTTPS"])
+      $scheme = "https";
+    else
+      $scheme = "http";
+
     $host = $_SERVER["HTTP_HOST"];
     $uri = $_SERVER["REQUEST_URI"];