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

URLs with a trailing slash result in a 404 #608

Closed
rjmackay opened this Issue Apr 21, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@rjmackay

rjmackay commented Apr 21, 2017

  • Lumen Version: 5.4.6
  • PHP Version: 5.6

Description:

Issue #66 is back
When writing in routes.php :

$app->get('welcome', function() { return 'Hello'; });

It responds to http://mysite.dev/welcome but with a trailing slash http://mysite.dev/welcome/, the site throws a 404. Unlike Laravel 5, where both URLs are recognised as the same.

@hakuno

This comment has been minimized.

Show comment
Hide comment
@hakuno

hakuno Apr 24, 2017

Contributor

The Lumen doesn't use the same route component of Laravel. So it doesn't fix the URL as done somewhere else.

That's OK. See why:

With trailing slash, conventionally a directory:

http://example.com/foo/

Without trailing slash, conventionally a file:

http://example.com/foo

Your own browser tend to fix that. Check it out by making one XHR with trailing slash at end. There'll be fixed to be without that.

So, your http://mysite.dev/welcome actually is http://mysite.dev/index.php/welcome that's a file!

Contributor

hakuno commented Apr 24, 2017

The Lumen doesn't use the same route component of Laravel. So it doesn't fix the URL as done somewhere else.

That's OK. See why:

With trailing slash, conventionally a directory:

http://example.com/foo/

Without trailing slash, conventionally a file:

http://example.com/foo

Your own browser tend to fix that. Check it out by making one XHR with trailing slash at end. There'll be fixed to be without that.

So, your http://mysite.dev/welcome actually is http://mysite.dev/index.php/welcome that's a file!

@rjmackay

This comment has been minimized.

Show comment
Hide comment
@rjmackay

rjmackay May 3, 2017

Your own browser tend to fix that. Check it out by making one XHR with trailing slash at end. There'll be fixed to be without that.

Sure, but browsers are not the only client we need to support. Lumen in particular is often used to build APIs where the client might not be an API.

Anyway. Looks like @Except10n has fixed it.. thanks!

rjmackay commented May 3, 2017

Your own browser tend to fix that. Check it out by making one XHR with trailing slash at end. There'll be fixed to be without that.

Sure, but browsers are not the only client we need to support. Lumen in particular is often used to build APIs where the client might not be an API.

Anyway. Looks like @Except10n has fixed it.. thanks!

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