FilamentPHP when using ->path('/') or ->path('')
is causing a 404 error when routes are cached.
Apache mod_alias
is being used to alias /v2
to the FilamentPHP public
directory at /var/www/html/public
accessed from https://localhost/v2
The current v1 public directory is at /var/www/html/www.80
accessed from
https://localhost
This uses a Docker container with PHP 8.2 and apache to mimic the issue.
When using ->path('/') or ->path('')
in the FilamentPHP routes, the following
error is thrown ONLY when the routes are cached:
The GET method is not supported for route /. Supported methods: HEAD.
You are still able to access any additional routes such as /v2/login, /v2/register, etc.
Though the root path /v2
is causing the error.
If you clear the cache, php artisan optimize:clear
the error goes away and the root path /v2
functions as normal.
- Clone the repository
- Install Composer packages
composer install
- Install node packages and build
npm install && npm run build
- Run the docker-compose file
docker compose up -d --build
- Add a the test user
php artisan filament:user
- Enter name:
Test User
- Enter email:
test@filamentphp.com
- Enter password:
password
- You'll be able to access the site at
- v1 - http://localhost/
- Filament PHP - https://localhost/v2
- Login to the Filament PHP site
- Go to https://localhost/v2/login
- Enter email:
test@filamentphp.com
- Enter password:
password
- You'll be redirected to the dashboard
- Now cache the routes
php artisan route:cache
- Try to access the dashboard with the cached routes
- It will error with the following message
The GET method is not supported for route /. Supported methods: HEAD.
The root path /v2
should not error when the routes are cached.