Video files not loading on initial load on caddy 2

1. Caddy version (caddy version):

v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=

2. How I run Caddy:

I run caddy using supervisord. Here is my sites configuration which serves images and videos. The root redirects to my personal blog.

i.rkus.io {
    root * /var/www/ma.rkus.io/skrins
    log /var/log/caddy.log
    tls m@rkus.io

    redir / https://ma.rkus.io 301

    encode gzip
    file_server
}

I know it’s terrible practice but it’s strictly a personal server so I run it as root like so

[program:caddy]
directory=/root/
command=/root/go/bin/caddy run --config /etc/caddy/Caddyfile
autostart=true
autorestart=false
startretries=1
user=root
environment=HOME="/root/",USER="root"
redirect_stderr=true
stdout_logfile=/var/log/supervisor/caddy.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10

a. System environment:

Ubuntu-1604-xenial-64-minimal

I keep things simple, no docker or anything else. Most things on this server are static files, wordpress or simple go programs.

b. Command:

See supervisord config above

c. Service/unit/compose file:

Nothing

d. My complete Caddyfile or JSON config:

176.9.107.67, 127.0.0.1 {
    tls markus@tenghamn.com
    root * /var/www/html
    log /var/log/caddy.log

    php_fastcgi unix//run/php/php7.0-fpm.sock

}

tenghamn.com, www.tenghamn.com, rkus.io, www.rkus.io {

    log /var/log/caddy.log

    rewrite / /main/

    redir /main/ https://ma.rkus.io 301

    redir /* https://archives.tenghamn.com{uri} 301


    root * /var/www/ma.rkus.io
    tls m@rkus.io
    php_fastcgi /run/php/php7.0-fpm.sock
    encode gzip
    file_server
}

markustenghamn.com, www.markustenghamn.com {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    rewrite / /main/

    redir /main/* https://ma.rkus.io 301

    redir /* https://archives.tenghamn.com{uri} 301
}

password.fun, www.password.fun {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log

    reverse_proxy localhost:8002
}

www.bcrypt.fun, bcrypt.fun {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    reverse_proxy localhost:8005
}

www.punycode.fun, punycode.fun {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    reverse_proxy localhost:8006
}

www.timestamp.fun, timestamp.fun {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    reverse_proxy localhost:8007
}

www.ipcheck.fun, ipcheck.fun {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    reverse_proxy localhost:8009
}

dinturnering.se, www.dinturnering.se, turnering.io, www.turnering.io, tournify.io, www.tournify.io {
    tls markus@tenghamn.com
    root * /var/www/tournify/public
    log /var/log/caddy.log

    php_fastcgi unix//run/php/php7.0-fpm.sock
    encode gzip
    file_server
}

www.uberswe.com, uberswe.com {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    root * /var/www/uberswe.com

    php_fastcgi unix//run/php/php7.0-fpm.sock
    encode gzip
    file_server
}

i.rkus.io {
    root * /var/www/ma.rkus.io/skrins
    log /var/log/caddy.log
    tls m@rkus.io

    redir / https://ma.rkus.io 301

    encode gzip
    file_server
}

ma.rkus.io {
    root * /var/www/ma.rkus.io
    log /var/log/caddy.log
    tls m@rkus.io
    php_fastcgi unix//run/php/php7.0-fpm.sock
    encode gzip
    file_server
}

www.gophp.io, gophp.io {
    root * /var/www/gophp.io
    tls markus@tenghamn.com
    log /var/log/caddy.log
    php_fastcgi unix//run/php/php7.0-fpm.sock
    encode gzip
    file_server
}

bot.uberswe.com {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log

    reverse_proxy localhost:8010 {
        header_up Host {host}
        header_up X-Real-IP {remote_host}
        header_up X-Forwarded-For {remote_host}
        header_up X-Forwarded-Proto {scheme}
    }
}

slack.gophp.io {
    tls markus@tenghamn.com
    log /var/log/caddy-access.log
    reverse_proxy localhost:9000
}

www.qby.se, qby.se {
    root * /var/www/qby.se
    log /var/log/caddy.log
    tls markus@tenghamn.com
    encode gzip
}

www.bridgely.io, bridgely.io {
    root * /var/www/bridgely.io
    log /var/log/caddy.log
    tls markus@tenghamn.com
    encode gzip
}

3. The problem I’m having:

The first time I open a video file it does not work. It only runs after refreshing the page. Here are some examples

Here is a video of what the video looks like when it’s not loading https://i.rkus.io/ciUGKPX9tYNhHWbfDji8kJ.mp4

I did not seem to have this issue with caddy v1. I don’t keep a backup of configs for this server so I can’t show you what my old config looked like.

The video files are uploaded over sftp using GitHub - slacki/skrins

4. Error messages and/or full log output:

I have not seen any error messages

5. What I already tried:

I have tried to figure out what might be wrong. I googled and searched but I can not seem to find any related issue.

6. Links to relevant resources:

I think the first three videos you posted are mistakes, they are just the cursor moving around on the forum.

What are the response headers? How can we reproduce this / see the same thing you’re seeing?

No, that was intentional. I didn’t visit them, I believe that it’s maybe the first time anyone visits the url that the video does not load as shown in my last video. I can try to reproduce this on a new, clean AWS instance and get back to you. I had initially hoped someone would see what I saw as my friend was able to reproduce it on his Mac.

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