1

I just implemented mod_auth_openidc authentication on an apache website and noticed that sometimes after sitting on a webpage for a few minutes, then navigating to another page, I get an error Warning: include(home?page=home.php): Failed to open stream: No such file or directory... on line 46. I notice that the link now has a duplicate subpage, https://domainname.com/application-stage/index.php?page=home?page=home. The end of the link should only have ?page=home once. I didn't notice this issue until after implementing mod_auth_openidc authentication, but it could also be possible that I overlooked it until now.

Below is part of the code where the error is occurring from. The <?php include $page.'.php' ?> line of code is line 46. Any ideas of why this is happening? I tried searching online and in this forum, but I wasn't really sure what "keywords" to use, so my results came up short.

<body>
    <?php include 'topbar.php' ?>
    <?php include 'navbar.php' ?>
  <div class="toast" id="alert_toast" role="alert" aria-live="assertive" aria-atomic="true">
    <div class="toast-body text-white">
    </div>
  </div>
  <main id="view-panel" >
      <?php $page = isset($_GET['page']) ? $_GET['page'] :'home'; ?>
    <?php include $page.'.php' ?>
    

  </main>
<nav id="sidebar">
<div class="sidebar-list">

                <a href="index.php?page=home" class="nav-item nav-home"><span class='icon-field'><i class="fa fa-home"></i></span> Home</a>
        </div>
</nav>
<script>
    $('.nav-<?php echo isset($_GET['page']) ? $_GET['page'] : '' ?>').addClass('active')
</script>
1TanMan
  • 11
  • 4
  • The portion of the code where you include files based on the parameter, isn't really relevant much. Where are you creating the links that lead to those faulty URLs? – CBroe May 06 '22 at 07:05
  • @CBroe I just added the code from the navigation bar. Hopefully that helps. I see the script ```$_GET['page']``` is included on the index.php and navbar.php page, could that be my issue? I would think this issue would occur all the time if so. – 1TanMan May 06 '22 at 12:34
  • 1
    I was expecting that you are creating those links dynamically somehow, but with the static `href` content, the problem can hardly stem from there. Do you have any URL rewriting in place? Does the mod_auth_openidc thing do anything regarding URL rewriting, and/or manipulation of the already generated HTML via some sort of filters or whatever? – CBroe May 06 '22 at 12:39
  • I am not aware of anything in the mod_auth_openidc config that would redirect or rewrite the URL. I did add a redirect to force HTTPS if you try to connect by HTTP Redirect / https://domainname/ in the httpd.conf for apache, but I wouldn't think this would be the issue since I am using HTTPS already. – 1TanMan May 24 '22 at 14:46

0 Answers0