Why is nextcloud causing a redirect loop (caddy webserver)?

I am trying to setup nextcloud on funtoo using the caddy webserver. After logging in, the URL is changed to http://192.168.1.30/index.php/apps/files/ and nextcloud gets into a redirect loop. What might be causing that?

I have loglevel set to 0 and nothing is being logged.

1 Like

Your webserver config. Caddy is not supported fyi

:80
root /var/www/localhost/htdocs/nextcloud
log /var/log/caddy-access.log
errors /var/log/caddy-errors.log
fastcgi / 127.0.0.1:9000 php {
env “HTTP_AUTHORIZATION” {>Authorization}
}

I have been in discussions on the caddy forums. It doesn’t appear to be related to this config.

To work with caddy, the following rewrite in the caddy configuration is required,

rewrite {
               r ^/index.php/.*$
                to /index.php?{query}
        }
1 Like

I’m glad this worked but the options websocket and transparent would have fixed it too.

As of Caddy v2, the equivalent should be:

rewrite /cloud/index.php/* /cloud/index.php?{query}

This is simply no longer required in v2.