You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run php-solid-server without the Docker image by running:
$ HOST=127.0.0.1 composer serve-dev
Browsing to http://127.0.0.1:8080 I get this error below. Any hints what I should do?
Static route "/" is shadowed by previously defined variable route "/((?:.|/)*)" for method "GET" (FastRoute\BadRouteException)
/Users/patrickhochstenbach/Dev/php-solid-server-0.6.2/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php:95
#0 /Users/patrickhochstenbach/Dev/php-solid-server-0.6.2/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php(30): FastRoute\DataGenerator\RegexBasedAbstract->addStaticRoute('GET', Array, Object(League\Route\Route))
#1 /Users/patrickhochstenbach/Dev/php-solid-server-0.6.2/vendor/nikic/fast-route/src/RouteCollector.php(44): FastRoute\DataGenerator\RegexBasedAbstract->addRoute('GET', Array, Object(League\Route\Route))
#2 /Users/patrickhochstenbach/Dev/php-solid-server-0.6.2/vendor/league/route/src/Router.php(165): FastRoute\RouteCollector->addRoute('GET', '/', Object(League\Route\Route))
#3 /Users/patrickhochstenbach/Dev/php-solid-server-0.6.2/vendor/league/route/src/Router.php(100): League\Route\Router->prepRoutes(Object(Laminas\Diactoros\ServerRequest))
#4 /Users/patrickhochstenbach/Dev/php-solid-server-0.6.2/web/index.php(222): League\Route\Router->dispatch(Object(Laminas\Diactoros\ServerRequest))
#5 {main}
My installation is OSX:
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.29-to-be-removed-in-future-macOS (cli) (built: Sep 6 2021 05:14:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies
The Solid Server must run on HTTPS according to the spec, but under certain conditions (for instance in development or when behind a proxy) this is not feasible. To make HTTP mode more explicit, the environment flag was changed from ENVIRONMENT to PROXY_MODE in 58110bf (part of v0.6.0). It looks like the command in the composer.json was not updated to reflect this change.
The composer serve-dev command is basically a simple wrapper for this command:
Activity
phochste commentedon Jan 30, 2022
This happens both with the current code in the main branch and in the v0.6.2 release.
[-]Question: How to run the Built-in PHP HTTP server?[/-][+]How to run the Built-in PHP HTTP server?[/+]Potherca commentedon Jan 30, 2022
Thank you for taking the time to report this!
The Solid Server must run on HTTPS according to the spec, but under certain conditions (for instance in development or when behind a proxy) this is not feasible. To make HTTP mode more explicit, the environment flag was changed from
ENVIRONMENTtoPROXY_MODEin 58110bf (part of v0.6.0). It looks like the command in thecomposer.jsonwas not updated to reflect this change.The
composer serve-devcommand is basically a simple wrapper for this command:The
PROXY_MODEvariable should be present but apparently it is not. 😥If you run the following (instead of
composer serve-dev) things should work as expected:(If you want to see debug information
ENVIRONMENT=developmentshould also be added).Beside this, it looks like the code responsible for the HTTP to HTTPS redirect is incorrect. The code should "just redirect" instead of triggering that warning.
I'll create a separate ticket for that.
phochste commentedon Jan 30, 2022
Thanks that works for me!