codeigniter4 / codeigniter4/CodeIgniter4

Bug: Inconsistent hostname/subdomain limitation in Routing

Open
#7,214 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
6k
Forks
2k
Avg merge
1d 11h
Merged PRs (30d)
73

Description

CodeIgniter version: 4.3.1

(1) `hostname` takes precedence over `subdomain`
if a route has both:
```php
$routes->get('/', 'Home::index');
$routes->get('/', 'Media::index', ['hostname' => 'media.example.com:8888', 'subdomain' => '*']);
```
`http://media.example.com:8888/ci431/public/` → `App\Controllers\Media::index`
`http://user.example.com:8888/ci431/public/` → `App\Controllers\Home::index`

(2) `subdomain` takes precedence over `hostname`
if two routes matches:
```php
$routes->get('/', 'Home::index');
$routes->get('/', 'Media::index', ['hostname' => 'media.example.com:8888']);
$routes->get('/', 'All::index', ['subdomain' => '*']);
```
`http://media.example.com:8888/ci431/public/` → `App\Controllers\All::index`
`http://user.example.com:8888/ci431/public/` → `App\Controllers\All::index`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.