-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bug: $routes->cli() accessible via web browser if autoroute is true #2704
Labels
bug
Verified issues on the current code behavior or pull requests that will fix them
Milestone
Comments
samsonasik
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Mar 14, 2020
samsonasik
added a commit
to samsonasik/CodeIgniter4
that referenced
this issue
Mar 15, 2020
… accessible via web browser even autoroute is true
2 tasks
I've created PR #2707 for it |
samsonasik
added a commit
to samsonasik/CodeIgniter4
that referenced
this issue
Mar 19, 2020
… accessible via web browser even autoroute is true
lonnieezell
added a commit
that referenced
this issue
Mar 22, 2020
Fix #2704: ensure route registered via $routes->cli() not accessible via web browser even autoroute is true
$routes->setAutoRoute(true);
$routes->cli('hello/(:segment)', 'Home::$1'); We can access: |
5 tasks
@kenjis Auto-routing is a different bag of worms. Unfortunately, it's how CodeIgniter apps have always worked, too. |
I should add this for anyone who might stumble across it that needs a solution. if(is_cli()) {
echo 'Hello';
} Then you could create an else block to redirect them to a 404. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example, I have the following
cli
route:and I have the controller:
then, I open it via web browser, it still accesible via :
http://ci4.local/commands/hello
, it still accessible.CodeIgniter 4 version
4.0.2
Expected behavior, and steps to reproduce if appropriate
By define
cli()
, it should decline the http access into it. The documentation doesn't say it require autoroute to be false:Context
The text was updated successfully, but these errors were encountered: