-
Notifications
You must be signed in to change notification settings - Fork 332
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 verification fails when running linkding behind a proxy such as nginx #340
Comments
same here, I'm using apache. |
Edit: This has been solved with #349 The README now provides instructions on how to configure Nginx, alternatively a new setting (
|
The new CSRF check in Django 4 requires that the values of the
From some testing it seems that Nginx changes the value of the So another solution is to configure Nginx to relay the original host header:
|
nginx subpath config,
|
Tested forwarding the I'm testing with the following docker-compose setup:
And this is
|
Hi! Thanks for the project. I tried to set it up with docker and NGinx reverse proxy, but I always get
This is my NGinx config and it does NOT work.
I usually use Any help is welcome! Thank you! |
For me, it works now. I added |
I have this error when using the API. It makes it impossible to use the extension. Even if I add the internal UUID of the extension to the allowed origins, it now returns: {"detail":"CSRF Failed: CSRF token missing."} For some reason, just using a very basic console request works flawlessly and without needing to allow extra origins or to edit nginx config: $ https example.com/linkding/api/bookmarks/ "Authorization:Token REDACTED" url='https://www.kytta.dev/'
HTTP/1.1 201 Created
[...]
{
...
} For information, I am using the latest Docker container (haven't tried downgrading yet) running on YunoHost 11.0.9.14 (as Redirect app) with their default Nginx config. I run it on a context path UPDATE: Removing the cookies for SSOwat ( UPDATE 2: I gave up and reconfigured the app to use a subdomain. Works like a charm 🤷♂️ |
That's actually a different error. All reports so far are for POST requests in the UI, where a valid CSRF token is passed, but then verification fails because host and origin don't match.
Not quite sure what's going on here. I just did a basic test with mis-configured CSRF in Nginx, and I can still add bookmarks through the extension. |
Since version 1.15.0 linkding uses Django 4.1, which introduces new restrictions to CSRF handling. This can cause CSRF verification to fail (for example during login) if the app is running behind a proxy and is not properly configured for it.
This needs investigation if the app can provide some default configuration out of the box, otherwise this requires documentation on how to properly configure CSRF when using a proxy.
The text was updated successfully, but these errors were encountered: