-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
PHP Version
8.0
CodeIgniter4 Version
4.1.9
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
The function current_url() returns the $baseURL in app/Config/App.php instead of the real current url in the browser.
This leads to confusion, know the documentation says:
You can restrict groups of routes to function only in certain domain or sub-domains of your application by passing the “hostname” option along with the desired domain to allow it on as part of the options array:
https://codeigniter.com/user_guide/incoming/routing.html?highlight=router#limit-to-hostname
Which means an app could have multiple domain pointing at it, but current_url() would only return the one set in config.
Use case: CMS, multi-tenant app, multi-vendor app, etc.
Steps to Reproduce
Call current_url() when loading the app with a host like sub.example.com while in the config, you would set $baseURL to www.example.com for example.
Expected Output
current_url() is the name implies should retour the current url and not the current url with $baseURL as host.
Anything else?
No response