V2: rainloop breaks with Caddy v2

I use Rainloop as my webmail frontend on my debian 10 amd64 machine and with Caddy v1 and the following setup/config:

$ tree -L 2 /etc/caddy/html/rl
/etc/caddy/html/rl
├── data
│   ├── _data_
│   ├── EMPTY
│   ├── index.html
│   ├── index.php
│   ├── INSTALLED
│   ├── SALT.php
│   └── VERSION
├── index.php
└── rainloop
    └── v

4 directories, 7 files

https://mail.hnrk.io {
                tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
                gzip {
                        ext *
                        level 4
                }
                fastcgi / unix:/run/php/php7.3-fpm.sock php {
                        root /etc/caddy/html/rl
                }
                header / {
                        Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"
                        X-XSS-Protection "1; mode=block;"
                        X-Content-Type-Options "nosniff"
                        X-Frame-Options "SAMEORIGIN"
                }
                limits {
                        header 64kb
                        body 8gb
                }
                timeouts {
                        read   5s
                        header 5s
                        write  0
                        idle   20s
                }
                root /etc/caddy/html/rl
                internal /data
                ext .html .htm .php
                log / /etc/caddy/logs/access.log
                errors /etc/caddy/logs/error.log
}

it works just fine, no errors:


When I run Caddy v2 instead with the same setup and the following config:

mail.hnrk.io {
        root * /etc/caddy/html/rl
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server * {
                hide /data
        }
}

Rainloop shows a blank white page and that is what the brave console says:

Do you have any idea why that is and if this actually has something to do with Caddy v2 mime type stuff?

Thanks! :smile:

UPDATE: Even with Caddy v2 beta 8, rainloop does not work properly… With v1, it does however.

@matt Maybe you have an idea? Seems to be a MIME related issue… Thanks! :slight_smile:

What are the response headers of the requests that are breaking?

I’ve had a closer look and it seems that rainloop, although a stylesheet is requested, sends an html document instead with Caddy v2:

Headers from Caddy v2 for the asset that breaks

v2headers

With Caddy v1, the site loads and gets the proper assets:

Headers from Caddy v1 for the asset that breaks in v2 but works fine in v1:

v1headers

Could it be that Caddy does somehow manipulate some files MIME types?

Your v2 Caddyfile doesn’t add file extensions implicitly like your v1 config does… did you solve this?

@HNRK, I think you may be able to get your assets served in v2 with a simpler config now. :slight_smile:

2 Likes

Thank you so much! This was the catch.

I run Caddy v2 with the following configuration, which makes rainloop work as expected! :tada:

{
	"experimental_http3": true
}
167.86.123.102:80, [2a02:c207:3004:1207:be:a:bad:babe]:80 {
	tls off
	redir https://hnrk.io{uri} 301
}
hnrk.io, www.hnrk.io {
	root * /etc/caddy/html
	tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
	encode brotli zstd gzip
	php_fastcgi unix//run/php/php7.3-fpm.sock
	file_server /md browse
	file_server
}
weather-frogs.de, www.weather-frogs.de {
	root * /etc/caddy/html/weather-frogs.de
	encode brotli zstd gzip
	php_fastcgi unix//run/php/php7.3-fpm.sock
	file_server
}
die-reikiquellen.de, www.die-reikiquellen.de {
        root * /etc/caddy/html/die-reikiquellen.de
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
harmoniks.de, www.harmoniks.de {
        root * /etc/caddy/html/harmoniks.de
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
hnrk.inet2.org {
	tls off
        root * /etc/caddy/html/inet2.org
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
ip.hnrk.io {
        root * /etc/caddy/html/myip
	tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
sql.hnrk.io {
        root * /etc/caddy/html/pma
	tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
postfix.hnrk.io {
        root * /etc/caddy/html/pfa/public
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
draw.hnrk.io {
        root * /etc/caddy/html/draw
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
mail.hnrk.io {
        root * /etc/caddy/html/rl
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
	try_files {path} /index.php?{query}
        file_server * {
			hide /data
	}
}
fotos.hnrk.io {
        root * /etc/caddy/html/fotos
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
proxy.hnrk.io {
        root * /etc/caddy/html/proxy
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
skip.hnrk.io {
        root * /etc/caddy/html/skip
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
zeit.hnrk.io {
        root * /etc/caddy/html/time
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
frequencies.hnrk.io {
        root * /etc/caddy/html/niviuk.free.fr/niviuk.free.fr
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
dns.hnrk.io {
        root * /etc/caddy/html/null
		reverse_proxy * localhost:10001
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
torrent.hnrk.io {
        root * /etc/caddy/html/null
	reverse_proxy * localhost:10004
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
wttr-test.hnrk.io {
	root * /etc/caddy/html/wttr
        tls /etc/caddy/hnrk.io.crt /etc/caddy/hnrk.io.key
        encode brotli zstd gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock
        file_server
}
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.