Skip to content

getBaseurl("") broken #513

@niol

Description

@niol

Hi, I do not understand the fix for #488 and what is broken on the openshift platform. The patch breaks the page shown after login, the page shown after logout and the RSS feed url (base URL becomes //site:443/subdir/ instead of https://site/subdir/).

Reverting the patch fixes the problem.

The following is even better as it gets rid of the useless :443.

diff --git a/helpers/View.php b/helpers/View.php
index 741879c..7e50e21 100644
--- a/helpers/View.php
+++ b/helpers/View.php
@@ -46,14 +46,15 @@ class View {
         } else {
             $lastSlash = strrpos($_SERVER['SCRIPT_NAME'], '/');
             $subdir = $lastSlash!==false ? substr($_SERVER['SCRIPT_NAME'], 0, $
-            // doesn't work on openshift with https
-            // let the browser handle protocol
-            $base =   /* 'http' .
-                      (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" ? 's
-                      '//' . $_SERVER["SERVER_NAME"] .
-                      ($_SERVER["SERVER_PORT"]!="80" ? ':'.$_SERVER["SERVER_POR
-                      $subdir .
-                      '/';
+            $protocol = 'http' . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]
+            $server = $_SERVER["SERVER_NAME"];
+            if( $_SERVER["SERVER_PORT"]!="80"
+                && $_SERVER["SERVER_PORT"]!="443" ) {
+                $port = ':'.$_SERVER["SERVER_PORT"];
+            } else {
+                $port = "";
+            }
+            $base = "$protocol://$server$port$subdir/";
         }

         return $base;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions