docker-mailman icon indicating copy to clipboard operation
docker-mailman copied to clipboard

CSRF on [hostname]/accounts/password/reset/

Open ferdinandyb opened this issue 2 years ago • 6 comments

I'm trying to set this up (version 0.4). I think I've been following the manuals, and got to the point where I could open the web interface, and as suggested, wanted to ask for a password-reset in email. Unfortunately, that leads to a 403 error, complaining about CSRF.

image

I have SERVE_FROM_DOMAIN=[myhost] and nginx set up as

    location / {
            proxy_pass http://127.0.0.1:8000;
            include uwsgi_params;
            uwsgi_read_timeout 300;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $remote_addr;

    }

Any ideas what could be going wrong here?

ferdinandyb avatar Jan 31 '23 21:01 ferdinandyb

Sadly I just arrived at the same error. Did you have any luck debugging this?

kolumdium avatar May 05 '23 15:05 kolumdium

@kolumdium no, I haven't investigated further yet.

ferdinandyb avatar May 07 '23 21:05 ferdinandyb

while trying to get the docker-containers running, i stumbled across this error too. I have investigated that this error is due to django CSRF check. I was able to fix it with this new nginx config line:

proxy_set_header X-Forwarded-Proto https;

Seems, that if the internal traffic goes over http and suddenly you have https traffic then the site thinks theres some errors and breaks.

Please someone test this out - just default setup :

server {

   listen 443 ssl default_server;
   listen [::]:443 ssl default_server;

   server_name MY_SERVER_NAME;
   location /static/ {
        alias /opt/mailman/web/static/;
   }

   location / {
           proxy_pass http://127.0.0.1:8000;
           proxy_set_header Host $host;
           proxy_set_header X-Forwarded-For $remote_addr;
           proxy_set_header X-Forwarded-Proto https;
   }
   ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
   ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;

}

veixus avatar Jul 19 '23 13:07 veixus

This issue has not been updated for more than 1year

github-actions[bot] avatar Jul 18 '24 22:07 github-actions[bot]

I am having same issue.

lispstudent avatar Jul 26 '24 14:07 lispstudent

But, adding the line as indicated above:

proxy_set_header X-Forwarded-Proto https;

I get 502 Bad Gateway.

lispstudent avatar Jul 26 '24 14:07 lispstudent