Too many redirects occurred

1. Caddy version (caddy version):

2.3.0

2. How I run Caddy:

Caddy start

a. System environment:

macOS Big Sur

b. Command:

Caddy start

c. Service/unit/compose file:

N/A

d. My complete Caddyfile or JSON config:


social.nofftopia.com, nofftopia.com, noff.co, www.nofftopia.com, www.noff.co, social.noff.co {

        root * /users/glen/public/www/mastodon/public*

        @try_masto file
        handle @try_masto {
                file_server
        }

        handle /api/v1/streaming* {
                reverse_proxy localhost:4000
        }

        handle {
                reverse_proxy localhost:3000
        }

        encode gzip

        header Strict-Transport-Security "max-age=31536000;"
        header /emoji* Cache-Control "public, max-age=31536000, immutable"
        header /packs* Cache-Control "public, max-age=31536000, immutable"
        header /system/accounts/avatars* Cache-Control "public, max-age=31536000, immutable"
        header /system/media_attachments/files* Cache-Control "public, max-age=31536000, immutable"

        handle_errors {
                root * /users/glen/public/www/mastodon/public
                rewrite 500.html
                file_server
        }
}

Fuzarooms.com, www.fuzarooms.com {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/fuzarooms.log
        }
}

fuzavue.com, www.fuzavue.com {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/fuzarooms.log
        }
}
Filez.noff.co {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/NoffFiles.log
        }
}
naughty.noff.co {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/naughty.log
        }
}
Discord.noff.co {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/discord.log
        }
}
fuzabeast.com, www.fuzabeast.com {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/fuzabeast.log
        }
}
Madame.noff.co/mastodon {
        reverse_proxy 10.0.0.30
}
Madame.noff.co/donate {
        reverse_proxy 10.0.0.30
}
Music.noff.co {
        reverse_proxy 10.0.0.30
}
Madame.noff.co {
        reverse_proxy 10.0.0.30
        log {
                output file /Users/glen/var/log/caddy/madamenof.log
        }
}

And on the second server, Caddyfile is

http://www.fuzavue.com, http://fuzavue.com {

    tls {
            on_demand
    }
    root * /users/glen/public/www/fuzavue
    encode gzip
    log {
            output file /Users/glen/var/log/caddy/fuzavue.log
    }
    #push {
    #}
    php_fastcgi 127.0.0.1:9000
    file_server

    @static {
            file
            path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff
    }

    header {
            # enable HSTS
            Strict-Transport-Security max-age=31536000;

            # disable clients from sniffing the media type
            X-Content-Type-Options nosniff

            # clickjacking protection
            X-Frame-Options DENY

            # keep referrer data off of HTTP connections
            Referrer-Policy no-referrer-when-downgrade
            Content-Security-Policy "upgrade-insecure-requests"
            X-XSS-Protection: 1
            @static Cache-Control "max-age=5184000"
    }

}

http://www.fuzarooms.com, http://fuzarooms.com {

    root * /users/glen/public/www/fuzarooms
    encode gzip
    log {
            output file /Users/glen/var/log/caddy/fuzarooms.log
    }
    #push {
    #}
    php_fastcgi 127.0.0.1:9000
    file_server

    @static {
            file
            path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff
    }

    header {
            # enable HSTS
            Strict-Transport-Security max-age=31536000;

            # disable clients from sniffing the media type
            #X-Content-Type-Options nosniff

            # clickjacking protection
            #X-Frame-Options DENY

            # keep referrer data off of HTTP connections
            Referrer-Policy no-referrer-when-downgrade
            Content-Security-Policy "upgrade-insecure-requests"
            #X-XSS-Protection: 1
            @static Cache-Control "max-age=5184000"
    }

}

http://amphp.noff.co {
root * /users/glen/public/www/AMPHP
encode gzip

    #push {
    #}
    php_fastcgi 127.0.0.1:9000
    file_server

    @static {
            file
            path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff
    }

    header {
            # enable HSTS
            Strict-Transport-Security max-age=31536000;

            # disable clients from sniffing the media type
            X-Content-Type-Options nosniff

            # clickjacking protection
            X-Frame-Options DENY

            # keep referrer data off of HTTP connections
            Referrer-Policy no-referrer-when-downgrade
            Content-Security-Policy "upgrade-insecure-requests"
            X-XSS-Protection: 1
            @static Cache-Control "max-age=5184000"
    }

}

http://discord.noff.co {
redir Jefftopia
}

http://fuzabeast.com, http://www.fuzabeast.com {
redir FuZaVue – FuZaVue's Sanctuaire
}

http://madame.noff.co/mastodon {
redir https://social.nofftopia.com/@seaham
}

http://madame.noff.co/donate {
redir https://donorbox.org/madamenof
}

http://music.noff.co {
redir mubo
}

http://madame.noff.co {
root * /users/glen/public/www/madamenof
encode gzip

    push {
    }
    php_fastcgi 127.0.0.1:9000
    file_server

    @static {
            file
            path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff
    }

    header {
            # enable HSTS
            Strict-Transport-Security max-age=31536000;

            # disable clients from sniffing the media type
            X-Content-Type-Options nosniff

            # clickjacking protection
            X-Frame-Options DENY

            # keep referrer data off of HTTP connections
            Referrer-Policy no-referrer-when-downgrade
            Content-Security-Policy "upgrade-insecure-requests"
            X-XSS-Protection: 1
            @static Cache-Control "max-age=5184000"
    }

}

3. The problem I’m having:

4. Error messages and/or full log output:

5. What I already tried:

Not sure what to do

6. Links to relevant resources:

N/A

Problem I’m having is that when I attempt to go to fuzarooms.com, I get an error saying too many redirects have occurred. Not sure how to fix this. Thanks in advance!

You seem to have an extra * at the end there, that doesn’t seem right. The root directive doesn’t set a matcher, it’s a path prefix specifying the location of your files.

That said, don’t macs use case-sensitive filesystems? I think you need /Users instead of /users. Might be wrong though.

On-Demand TLS isn’t useful for you here, because you’re in an http:// site, and you’re not in a site that allows for custom domains. You can remove that tls block.

This isn’t right, you can’t use a matcher inside of the header directive block. You’ll need to split that out into its own header @static line, outside of that header block.

This isn’t right, it’ll attempt to set a header called X-XSS-Protection: (note the :). Remove the :.

With all that said, please try again and next time, post your configs with ``` on the lines before and after your config, to properly use code formatting on the forums. It’s hard to read your config because of the messy formatting. Some parts of your config were transformed because they were parsed by the forum as links.

I appreciate the suggestions and will make the changes, though that doesn’t address the issue I’m having. All other sites work, only issue I’m having is too make redirections with https://fuzarooms.com :confused:

Surprisingly, the website loads the 404 page if I do not have the ‘*’ at the end of root

You mean it works when you use the above, but not when you use the following?

root * /users/glen/public/www/mastodon/public

That doesn’t make any sense.

Like I said, please fix your original post, the config formatting is still quite messy and hard to read, so I’ll have trouble tracking down the problem.

I think he means root * /users/glen/public/www/mastodon/public yields a 404. This makes sense if there is no index file in the directory.

I will work on reformatting the post when I get off work.

Yeah, sorry i worded that poorly, you interpreted my reply correctly about the 404 page

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