Any insight or help greatly appreciated, I’m banging my head after 6hrs of trying to get to the bottom of this.
1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
Via systemctl
a. System environment:
Ubuntu 22.04 LTS, PHP 8.1, MariaDB
b. Command:
sudo systemctl reload caddy
c. Service/unit/compose file:
n/a
d. My complete Caddy config:
theforge.viewcreative.agency {
root * /websites/the-forge/web
encode gzip zstd
php_fastcgi unix//run/php/php8.1-fpm.sock {
try_files {path} /index.php?p={path}{query}
}
file_server
log {
output file /websites/_logs/theforge.log
}
}
3. The problem I’m having:
The CMS itself works for some pages and not others. The front end of the site breaks in the same manner as some of the CMS pages.
Specifically, there are pages in the CMS that load “views” through an AJAX call. The pages that are failing are all spinning endlessly with no response from the server.
Pages that don’t use the AJAX in the CMS are working.
4. Error messages and/or full log output:
Nothing in logs because it never actually completes the request. There’s nothing in php logs, nothing in Caddy, nothing in the Craft logs.
5. What I already tried:
I’ve tried the default config of
theforge.viewcreative.agency {
root * /websites/the-forge/web
encode gzip zstd
php_fastcgi unix//run/php/php8.1-fpm.sock
file_server
log {
output file /websites/_logs/theforge.log
}
}
I’ve tried variations on the quoted config too. The CMS expects Apache, and it’s .htaccess is:
<IfModule mod_rewrite.c>
RewriteEngine On
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
I have been trying to convert that to Caddyfile syntax assuming this to be the issue.
I’ve tried finding anyone else using Caddy with Craft4 but it seems like if people are, no one has documented it.
6. Links to relevant resources:
https://craftcms.com/docs/4.x/requirements.html#minimum-system-specs
Network “activity” on the broken request (I killed php after 7min):
Further info:
If I turn off Craft’s “omitScriptNamesInURLs” option we end up with URLs such as
https://theforge.viewcreative.agency/index.php?p=secretadmin/utilities/system-report
This works.
Failing URLs seem to be of the format (taken from browser dev tools Network inspector):
https://theforge.viewcreative.agency/index.php?p=secretadmin%2Factions%2Felement-indexes%2Fget-elements&v=1669135650242