How to serve EteBase with Caddy?

I’m trying to serve some static files from this EteSync Docker image. I’ve got all the Docker stuff working, so no need to worry about that. What I’m now trying to do is convert this nginx config to a Caddyfile config.

upstream etebase {
    server etebase:3735; # for a web port socket (we'll use this first)

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    charset utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    location /static/ {
        autoindex on;
        alias /srv/etebase/static/; # Project's static files

    location /user-media/ {
        autoindex on;
        alias /srv/etebase/media/; 

    location / {
        proxy_pass http://etebase;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $server_name;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;

I was thinking it would just be something like this, because the static files are in /srv/etebase/static. { # EteSync
      route {
          file_server * browse {
              root /srv/etebase/static
          reverse_proxy localhost:3735


This does server the static files, but there’s a lot of other complicated looking stuff in the nginx config, and I’m not sure if I’ve converted it all over.

My Caddy version is 2.4.6, by the way.


That’s basically it. The reference nginx config just sets some ancillary things like error pages and limiting request body size, etc. (It does also enable directory browsing for the /user-media/ endpoint, but that might be optional, I dunno.)

You can set custom error pages with Caddy’s handle_errors directive, and limit request body size with the request_body directive.

1 Like

Wow, that’s so much better. Thanks!

Actually one more small question. There’s an option to use HTTPS for Uvicorn, should I do that, or will Caddy handle the HTTPS?

HTTPS is automatic.

1 Like

Okay, thanks!

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