This is a repo to provide some rough tests about PATH_INFO support in Caddy v2.x using containers via docker-compose.
The code here is just a proof to help the work in caddyserver/caddy#3718 by comparing how 3 different vendors (caddy, apache and nginx) manage the same set of URLs pointing to a PHP script charged to use PATH_INFO to perform some kind of routing.
PHP has been exposed via FPM using v7.4.10 w/o any supplementar extension but those provided by the official docker image.
Caddy v2.1.1 is provided by the official docker image and it has been configured:
- using the standard
php_fastcgidirective, which has an issue in properly managingPATH_INFO, described in caddyserver/caddy#3718 - using a variation of the expanded form of the
php_fastcgidirective to avoid the "redirection issue"
Besides, the Caddy v2.1.1 official docker image has been used to host the binary which contains the candidate fix, directly taken from a related GH Action (https://github.com/caddyserver/caddy/actions/runs/263950314), using the standard php_fastcgi directive to show the effect of the fix.
Apache v2.4.38 is provided by the official docker image i.e. PHP runs as module w/o any PHP configuration change.
Nginx v1.19.2 is provided by the official docker image and it has been configured to serve PHP via the PHP-FPM service.
The included PHP files are:
www/
├── file.php
├── index.php
├── lib
│ └── javascript.php
└── tests
└── testsuite.php
index.phpjust outputs the$_SERVERarray and bothfile.phpandlib/javascript.phpincludeindex.php, to simulate different routing files, w/ the goal of having one among the others declared as an index filetestsuite.phpjust automates the test against a set of "interesting URLs" to evaluate the "expected vs actual" result:/lib/javascript.php/1599824490/lib/requirejs/require.min.js/index.php/foo/index.php/foo?a=1&b=2/foo/foo.php/foo/file.php/filename_UTF8_en+coded_それが動作するはず.png/index.php/some%20%20whitespaces
To setup the 5 web server instances just fire the Compose:
$ docker-compose up -dand then point your browser to http://:8080/tests/testsuite.php to see the result of testing the 3 vendors against a set of fixtures coded into that file.
To stop everything just issue:
$ docker-compose down -v- Any change to a web server configuration requires to stop and start the Compose or just that web server container
- PHP code can be changed at any time without the need to restart anything
- The Caddy issue, when resolved, will be used to bump the interest to add Caddy "native" support into Moodle i.e. w/o the need to fake it as "Apache" via
env SERVER_SOFTWARE Apache. @scara will do it via MDL-57646 (Caddy server support) 😉
Have fun!