301 redirect loop

I have tried installing Mastodon many times and I always end up with the same problem.

Whenever I try to browns the home page, it redirects 301 back to itself…

I am installing it on docker and using the docker compose file included in the git.

This is in the log, over and over again;

method=GET path=/ format=html controller=HomeController action=index status=301 duration=0.71 view=0.00 db=0.00 location=https://social.stuartbrand.co.uk/

Hey.

If you have the same problem as me, it’s because you just set up HTTPS and your reverse proxy (nginx, maybe?) isn’t passing through the protocol.

location / {
        proxy_pass http://mast_backend;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
}

So, it attempts to keep redirecting to HTTPS, but the Rails server will never realise it already has.

Thanks, you are correct. I am using HAPROXY and needed to pass through the https header, as you suggested

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.