Craft CMS 4 and broken CMS views [SOLVED]

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:


d. My complete Caddy config: {
	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}
	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 {
	root * /websites/the-forge/web
	encode gzip zstd
	php_fastcgi unix//run/php/php8.1-fpm.sock
	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]

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:

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

This works.

Failing URLs seem to be of the format (taken from browser dev tools Network inspector):

This turned out not to be a Caddy issue. Or a PHP issue.

I ran htop and discovered that there’s a horrific bug in MariaDB 10.6+ that was causing gigantic server loads.

importing an SQL dump can result in indexes not being created properly


This topic was automatically closed after 30 days. New replies are no longer allowed.