Skip to content
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

trailing slash is required on URL #855

Open
humantex opened this issue Aug 2, 2017 · 5 comments

Comments

@humantex
Copy link

commented Aug 2, 2017

Problem

Installed on my local dev server, on Windows 7 - I've had 2 issues where trailing slashes were required to get pages to display without getting a consistent and repeatable 403 Forbidden error.

  1. Installation in a subfolder failed with a 403, using i.e., 192.168.0.123/pagekit as the URL. Rather than dig in too deep for a solution, I temporarily deleted the 2 Apache 'Ifmodule' sections to complete the install, but in hindsight now, I may have only needed to add a trailing slash and/or specified a page name [i.e., index.php]. After the install was done I re-added the Ifmodule lines, and the script works correctly - except for issue 2...

  2. Once installed, going to the root/index page using just the subfolder name in the URL [192.168.0.123/pagekit] will result in a 403 Forbidden error. Adding a trailing slash [192.168.0.123/pagekit/] gives me the correct page.

I tried adding a section to the top of .htaccess to force a DirectoryIndex handler and disable MultiView, but that was no help. The 403's reappear if I try to open the site without the slash.

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Make sure MultiViews is disabled if available.
<IfModule mod_negotiation.c>
  Options -MultiViews
</IfModule>

Since the site code never even gets a chance to execute, there are no debug messages, console errors, or any logs to check.

Ultimately this would be moved to a proper subdomain on a production Linux server, so I don't think it will be an issue when everything is in document-root, but as it is now, I have to remember to add the slash if I get a 403.

Technical Details

  • Pagekit version: 1.0.12
  • Webserver: Ampps 3.7 [Apache 2.4.25]
  • Database: sqlite 3.8.10.2
  • PHP Version: 5.6.30
@humantex

This comment has been minimized.

Copy link
Author

commented Aug 2, 2017

Well I'm truly stumped now. I thought I'd try out a 2nd install to find out if the slash was all I'd missed on the earlier install that failed to load any start page. I used the exact same zip file I'd downloaded and had used before, on the exact same dev server, and used another subfolder just as I did before - except I named it '/pagekit-2'.

I typed in the URL in FireFox without the trailing slash, and watched as the trailing slash was added to the URL, and the page flipped over to the '/installer' directory - and soon after, up popped the bouncing arrow page. I tried the same in Chrome, with exactly the same result. I went back to FireFox and completed a new install without a hitch. I also got logged in without error, and displayed the home page too - with a trailing slash being added automagically. I again went back to Chrome to try the home page on the completed install, and got the automatic slash and a viewable page.

It's not for trying, since I expected the same outcome and I'd consciously followed the same steps as before. My system hasn't changed in 24 hours and I'd certainly made no code changes before trying, so I have no real clue why the 2nd attempt worked when the 1st did not. The odd part is that the original install still requires the manual addition of the slash, while the 2nd doesn't. Could it be the use of the word "pagekit" as a directory name that was enough to cause the issue? Again... no idea, just grasping for possibilities.

I think I'll switch over to using the 2nd install as a dev site - just in case.

@SPQRInc

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2017

I can not confirm this on my VM. Maybe anybody else can try to reproduce this?

@humantex

This comment has been minimized.

Copy link
Author

commented Aug 3, 2017

If it would be of any use, I can always zip up the site and post it for one of the devs to grab. It's not impossible that 7zip managed to mangle something during the extraction, and it could even be Win 7 doing something whacky - it has before, and will probably do it again. That's not to say that I couldn't have inadvertently mucked something up too, but I rarely screw up the simple stuff after 35+ years of IT work.

I'm just glad that the 2nd install went well and it's behaving as expected so far. The planned site is a small information-type subdomain, and Pagekit would work well for what's needed... so unless a real show-stopper pops up, it's got the job at the moment.

@morags

This comment has been minimized.

Copy link

commented Nov 8, 2017

Confirmed on VM.

  • Pagekit 1.0.13
  • Bitnami's LAMP stack v7.1.10-1:
    • Apache 2.4.28
    • sqlite3 3.7.15.1
    • PHP 7.1.10
@gholleyd

This comment has been minimized.

Copy link

commented Jun 22, 2018

This happens because of the first block in .htaccess

<FilesMatch "((\.(lock|cache|db))|installed.json|composer.json|package.json|bower.json|CHANGELOG.md|README.md|gulpfile.js|webpack.config.js|pagekit)$">
      # Apache < 2.3
        <IfModule !mod_authz_core.c>
            Order allow,deny
            Deny from all
            Satisfy All
        </IfModule>

        # Apache ≥ 2.3
        <IfModule mod_authz_core.c>
            Require all denied
        </IfModule>
</FilesMatch>

If you look in the condition for the FilesMatch, you can see the or condition for the pagekit CLI executable, at the very end.

So, in essence, you cannot run pagekit in a directory named pagekit. If you change that folder to any other compatible name, or add a slash to throw off the FilesMatch condition, you'll be just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.