Continuing the discussion from Symfony app under symlinked dir, subpath handled by file_server instead of php_fastcgi:
I can say now that even though I still have the symlink for browsing purposes, the handle
directive is better to set a custom root
just for this handle
block.
However, there is still an issue.
I updated Caddy to v2.6.2, and I also updated the Caddyfile’s vhost:
demo.orbitale.io {
encode gzip
handle / {
root / /var/www/demo.orbitale.io/www/
file_server browse
}
# The app we're looking for
handle /orbitale_cms/* {
uri strip_prefix /orbitale_cms
root * /var/www/demo.orbitale.io/repos/demos.orbitale_cms/public/
php_fastcgi unix//run/php/php8.1-fpm.sock {
root /var/www/demo.orbitale.io/repos/demos.orbitale_cms/public/
}
}
# Fallback
php_fastcgi * unix//run/php/php8.1-fpm.sock
file_server
tls <redacted>
log {
output file /var/www/demo.orbitale.io/access.log {
roll_size 512mb
roll_keep_for 720h
}
}
}
When I go to https://demo.orbitale.io/orbitale_cms/admin
, an URL that can trigger Symfony’s backend, and it shows me a 404 not found: cannot find url /orbitale_cms/admin
, so the Symfony backend is actually called.
If I just replace the whole index.php
with solely phpinfo();
, I see that the document root and script name are okay, but the REQUEST_URI
still contains the wrong part even with the uri strip_prefix /orbitale_cms
directive in the Caddyfile.
Am I forgetting something about this prefix? I found nothing relevant in the php_fastcgi
expanded form
Edit: I even tried to copy/paste the expanded form and add the header_up X-Forwarded-Prefix /orbitale_cms
directive, to see if it wasn’t a reverse-proxy issue or something, and it doesn’t do anything.