New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap helpers.php -> nav_is check not working for https requests terminated on proxy/load balancer - Navigation level 2 not shown #1784

krausste opened this Issue Feb 19, 2018 · 3 comments


None yet
3 participants

krausste commented Feb 19, 2018

Expected behaviour

Working nav_is check and navigation level 2 shown.

Actual behaviour

Navigation level 2 not shown.
Reason: Even though the protocol is https request()->url() might return an url with protocol http. In case Statamic is running in a proxy or load balancer environment. The following comparison of this returned url with the given url (https) will return false even though it should be true.

Steps to reproduce

  1. Setup Statamic in an proxy / load balancer environment with https
  2. Login to Statamic
  3. Navigate to e.g. config-> Settings

Server Details

Statamic Version: 2.8.3


This is the fix that we are currently using:

Subject: [PATCH] Fixed nav_is check where the correct protocol gets lost via
 the request url cehck

 statamic/statamic/bootstrap/helpers.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/statamic/statamic/bootstrap/helpers.php b/statamic/statamic/bootstrap/helpers.php
index 5d4e2d1a1..926d73186 100644
--- a/statamic/statamic/bootstrap/helpers.php
+++ b/statamic/statamic/bootstrap/helpers.php
@@ -379,6 +379,11 @@ function nav_is($url)
     $url = preg_replace('/^index\.php\//', '', $url);
     $current = request()->url();

+    // The correct protocol (https) might get lost when using proxy or load balancer
+    if (request()->header("X-Forwarded-Proto") === "https") {
+        $current = preg_replace("/^http:/i", "https:", $current);
+    }
     return $url === $current || Str::startsWith($current, $url.'/');

This comment has been minimized.

krausste commented May 25, 2018

Unfortunately this is still not fixed in version 2.9.2 for us.
Can we reopen this ticket or do you want me to create a new one?
Thank you in advance!


This comment has been minimized.

krausste commented Jun 11, 2018

FYI: Also the latest change in 2.9.7/8 is not fixing the issue.


This comment has been minimized.


jasonvarga commented Jun 11, 2018

Do you have the correct URL set in system.yaml locales ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment