Resource interpreted as Stylesheet but transferred with MIME type text/plain

Hi there :slight_smile:

since I upgraded to Caddy 2 today, my stylesheets, of the directive, are interpreted as text/plain. Anyone knows this problem?

1. Caddy version (caddy version):

v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=

2. How I run Caddy:

Via systemd


ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile


a. System environment:

Ubuntu 18.04.4 LTS

d. My complete Caddyfile or JSON config: {
        root * /var/www/
        php_fastcgi unix//run/php/php7.2-fpm.sock
} {
        root * /var/www/
} {
        reverse_proxy localhost:3000
} {
        reverse_proxy localhost:802

3. The problem I’m having:

Browsers interprets the CSS files as text/plain.

4. Error messages and/or full log output:

No Error in logs

5. What I already tried:

Check local mime types:

$ cat /etc/mime.types | grep text/css
text/css					css

6. Links to relevant resources:


Is there anything at ? I am getting a content length of 0.

Yes, its 99554 Bytes big. I changes nothing on my site. I only upgraded caddy…

Since you’re using the php_fastcgi directive, @francislavoie might have a better idea as to what’s going on…

My guess is that you don’t have the static file server enabled. Is your PHP backend serving up static CSS assets too?

Well, you upgraded Caddy and wrote a new Caddyfile, necessarily, so there could be something wrong with the Caddyfile you wrote too.

1 Like

Yes you are right :sweat_smile:

Thanks for your hints and quick reply. :bowing_man:

I added the static_file directive to my kuhweblab config, and everything works as I want.

1 Like

Yeah to clarify, in Caddy v2, there’s no file server enabled by default, you need to add file_server. From the looks of your Caddyfile you posted earlier, you’d need to add that for your site and your first site.


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