# Discourse Integration Nextcloud bad csrf

**URL:** <https://meta.discourse.org/t/discourse-integration-nextcloud-bad-csrf/215218>\
**Category:** Self-hosting\
**Created:** [January 18, 2022, 12:44pm UTC](https://meta.discourse.org/t/discourse-integration-nextcloud-bad-csrf/215218 "2022-01-18T12:44:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![solarsimon](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@solarsimon](https://meta.discourse.org/u/solarsimon)\
**Post date:** [January 18, 2022, 12:44pm UTC](https://meta.discourse.org/t/discourse-integration-nextcloud-bad-csrf/215218/1 "2022-01-18T12:44:37Z")

</div>

Hi there,

I am trying to get the Dashboard integration running in our Nextcloud (22.2.3)  
We used to have a discourse instance running on discourse.group where the connection worked fine.

Since we moved our discourse instance to self hosted, it does not work anymore.  
Now discourse is running on a hetzner server in a Docker container. Nothing else running on that server. The DNS is configured with an A-Record.  
For installation, i followed this guide: [https://linoxide.com/install-discourse-docker-container/](https://linoxide.com/install-discourse-docker-container/)

I have found a description of a solution. But don’t know what steps to do.  
Does anyone know how to solve that issue in my setup?

> [@Troubleshooting "BAD CSRF" error on initial site setup?](https://meta.discourse.org/t/troubleshooting-bad-csrf-error-on-initial-site-setup/97059/19):
>
> The other site was also on cloudflare but didn’t have caching enabled. The new site root has aggressive caching enabled via page rules, which would also apply to subfolders, hence the issue. Browser Cache TTL: a month, Always Online: On, Cache Level: Cache Everything, Edge Cache TTL: 2419200 seconds I also think following header is also critical. proxy\_set\_header X-Forwarded-Proto https;

> [@Troubleshooting "BAD CSRF" error on initial site setup?](https://meta.discourse.org/t/troubleshooting-bad-csrf-error-on-initial-site-setup/97059/17):
>
> For anyone else banging their head facing this issue. Please read below.
> 
> I was having similar issue. In my case we are behind Cloudflare, then Nginx and the setup was for a forum on subfolder.
> 
> Ultimately following combination worked.
> 
> - Disabling caching for the subfolder on Cloudflare
> - Following Nginx block
> 
> ```plaintext
> location /folder {
> proxy_ssl_server_name on;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header X-Forwarded-Proto https;
> proxy_pass http://localhost:1357/folder;
> }
> 
> ```

---

_[View the full topic](https://meta.discourse.org/t/discourse-integration-nextcloud-bad-csrf/215218)._
