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 403 error when trying to enable guest agent. #630

Open
oreillymj opened this issue Jan 15, 2024 · 4 comments
Open

CSRF 403 error when trying to enable guest agent. #630

oreillymj opened this issue Jan 15, 2024 · 4 comments

Comments

@oreillymj
Copy link

Since upgrading to the latest version of Webvirt cloud and associated django version, I see CSRF 403 errors when using the UI.
Specifically trying to enable the guest agent.

Looking at Chrome dev tools, I see a mis-match between the forms csrf token and the value in the csrf cookie.

I'm completely unable to login in a private window due to a 403.

When looking at dev tools, I see cookie set to
csrftoken=zhMVW2QdpvjMWGcW8umYb32sUYvlEu5z; token=3-5570c1d9-8da8-437e-84e4-fb5ce744b36e

but the csrftoken on the embedded form is ....

csrfmiddlewaretoken: 878NbOOzWhERjIK09BJGlZinBQ7zrxXyxeKyXGuCbCNt5eMM7VVumSaFlEsKVRSX

Not sure if that mismatch causes the 403

csrf3_2024-01-15_151123
csrf2_2024-01-15_151028
csrf1_2024-01-15_150934

@catborise
Copy link
Collaborator

Could you be trying to reactivate a previously activated device? "Disconnected" typically means that guest tools are not installed on the operating system or the guest service is not running.

@oreillymj
Copy link
Author

All was working before upgrading to latest github commit. supervisorctl shows 3 running services.
I should mention that I have upgrade from Ubuntu20.04LTS ->22.04LTS, got Webvirtcloud running and I'm now on the 24.04 beta. I had to re-run pip3 so I maybe on a newer Django release which has stricter CSRF protection.

https://docs.djangoproject.com/en/5.0/howto/csrf/

@whsir
Copy link

whsir commented Apr 2, 2024

I'm having the same problem.
CSRF 403

@jbguo424
Copy link

jbguo424 commented May 7, 2024

Modify the settings.py like below
CSRF_TRUSTED_ORIGINS = ['http://localhost','http://your ip']

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