cvat: 「Forbidden (403) CSRF verification failed. Request aborted」in Django administration page
My actions before raising this issue
I used K8S to deploy all the services that cvat depends on in the cluster. The deployment is as follows:
Then, I went to the backend-server pod and created a superuser account with the command python3 ~/manage.py createsuperuser
Next, I went back to the Web page, logged in the superuser account with the browser, and entered the background management page, as shown below:
Steps to Reproduce (for bugs)
In the Django administration page, all my Post requests are getting errors like this:
Possible Solution
After Google, I found a workable solution: https://github.com/doccano/doccano/issues/1820
Your Environment
As mentioned above, I used the official ymal file to deploy the various services in the K8S cluster. We haven’t used Django before, so we don’t know how to add annotations to our code. I was looking for a way to fix this by adding an environment variable to the backend-server deploy file.
Thanks for thinking about this!!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 17
@kelbstf This is the solution I came up with. Although it may not be perfect, it’s functional.
docker-compose.override.ymlfile. This file allows you to extend or override settings from the original docker-compose.yml.production.pyfile located at./cvat/settings/production.pyinto a new file named./production.py.Thank you so much for this solution!
As far as i know those settings are only applied when you use the development mode, not the production mode? Assuming a normal “vanilla” helm install:
So if you would like to use the development.py options, you have to add a ENV variable to your helm chart called DJANGO_CONFIGURATION with the value of “development”.
@kelbstf I did a quick deep dive and couldn’t get it figured out. My situation was using cloudflared proxy for public access and I could not get it to work.
My guess is that when the tus or whatever lib it is gets init’d, it needs an option to disable CORS or configure it for CVAT_HOST. At the time I was super busy so couldn’t take the time to fix the issue and now I’ve moved on to other software.
IIRC, it was issue after issue after issue and I had gotten fed up. Cvat team doest reply to non trivial issues and when they do, they usually say “it works on our cloud hosted service, you should stop self hosting and subscribe to our cloud service” instead of doing any meaningful troubleshooting and fixing.
I have CVAT behind a cloudflared tunnel and am getting the 403 forbidden CSRF on django admin page POST. The provided fix says to use the
CSRF_TRUSTED_ORIGINSenv var but, Adding it to all the containers doesnt seem to solve the issue.in the docker-compose.yml where do I add the ENV var?
I put it in cvat-server, cvat-ui, cvat-utils and I am still getting CSRF 403 forbidden