Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ferdinandyb opened this issue Jan 31, 2023 · 6 comments
Open

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

ferdinandyb opened this issue Jan 31, 2023 · 6 comments

Comments

@ferdinandyb
Copy link

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?

@kolumdium
Copy link

kolumdium commented May 5, 2023

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

@ferdinandyb
Copy link
Author

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

@veixus
Copy link

veixus commented Jul 19, 2023

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;

}

Copy link

This issue has not been updated for more than 1year

@lispstudent
Copy link

I am having same issue.

@lispstudent
Copy link

But, adding the line as indicated above:

proxy_set_header X-Forwarded-Proto https;

I get 502 Bad Gateway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants