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 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

root /var/www/localhost/htdocs/nextcloud
log /var/log/caddy-access.log
errors /var/log/caddy-errors.log
fastcgi / 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.