# CSRF token verification failed! - Docker nginx zammand.conf

**URL:** <https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212>\
**Category:** Technical assistance\
**Created:** [February 10, 2021, 1:48am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212 "2021-02-10T01:48:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![technoicon](https://community.zammad.org/user_avatar/community.zammad.org/technoicon/32/3736_2.png) [@technoicon](https://community.zammad.org/u/technoicon)\
**Post date:** [February 10, 2021, 1:48am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/1 "2021-02-10T01:48:50Z")

</div>

- Used Zammad version: 3.6.0
- Used Zammad installation source: Docker-compose
- Operating system: ubuntu 20.04.2
- Browser + version: chrome latest.

### Expected behavior:

\*Be able to login

### Actual behavior:

- CSRF token verification failed!

### Steps to reproduce the behavior:

I’ve tried everything to get my login working again.  
It worked fine for my original users but any new users can not login they get this error: CSRF token verification failed!.

I’ve tried setting the zammad.conf in the docker image zammad-nginx /opt/zammad/contrib/nginx/zammad.conf  
From:  
proxy\_set\_header X-Forwarded-Proto $scheme;  
to  
proxy\_set\_header X-Forwarded-Proto https;

but when I reload nginx, the default config changes this back to:  
proxy\_set\_header X-Forwarded-Proto $scheme;

I then did the following:

```auto
map $http_x_forwarded_proto $real_scheme {
default $http_x_forwarded_proto;
‘’ $scheme;
}

```

to the “server {” in zammad config file. This has now broken nginx docker container and it kicks me out of bash after 3-4 seconds. So I can’t get that working at all.

I’m really new to docker and this has been really frustrating, I just need a little help to force https and get the login for zammad working again.  
I’m running the nginx proxy which all looks fine, I also run cloudflare but I have tried both disabling and enabling this with the same results.

I’m out of options. any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![rsysadmin](https://community.zammad.org/user_avatar/community.zammad.org/rsysadmin/32/3306_2.png) [@rsysadmin](https://community.zammad.org/u/rsysadmin)\
**Post date:** [February 10, 2021, 9:00am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/2 "2021-02-10T09:00:20Z")

</div>

Hi @technoicon

there are several posts on this subject. Just do a search for “CSFR” and you will find plenty of solutions that have already been discussed in the forum.

HTH!

Best,  
Martin

---

<div class="post-metadata">

**Author:** ![technoicon](https://community.zammad.org/user_avatar/community.zammad.org/technoicon/32/3736_2.png) [@technoicon](https://community.zammad.org/u/technoicon)\
**Post date:** [February 10, 2021, 10:26am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/3 "2021-02-10T10:26:57Z")

</div>

Figured out that Zammad is listening on HTTP but the settings were set to HTTPS which is really what I want to use but to get it working I set zammad to http using this command.

```auto
docker exec -it zammad-docker-compose_zammad-railsserver_1 bash
rails c
Setting.get('http_type')
=> "https"
Setting.set('http_type','http')
quit
exit
docker-compose down
docker-compose up -d

```

So from what I can understand now, My reverse proxy takes the connection via https, then connects to zammad via http.

I tried so many things to make https work all the way through, but it just doesn’t and changing any settings in the zammad-nginx container doesn’t seem to work for whatever reason.

I’m not a docker expert so I don’t understand how that works.

---

<div class="post-metadata">

**Author:** ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)\
**Post date:** [March 4, 2021, 1:01pm UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/4 "2021-03-04T13:01:39Z")

</div>

If you’re accessing Zammad via https in your Browser, the `http_type` **has** to be `https`.  
Other wise you’ll have issues with accessing and using Zammad.

Also note that the compose has environment files which you can use to override default values if needed:

> <https://github.com/zammad/zammad-docker-compose/blob/master/containers/zammad/docker-entrypoint.sh#L15-L16>

---

<div class="post-metadata">

**Author:** ![technoicon](https://community.zammad.org/user_avatar/community.zammad.org/technoicon/32/3736_2.png) [@technoicon](https://community.zammad.org/u/technoicon)\
**Post date:** [March 22, 2021, 6:12am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/5 "2021-03-22T06:12:10Z")

</div>

> [@MrGeneration](#):
>
> Also note that the compose has environment files which you can use to override default values if needed:

I have no idea what this means.  
What is the compose?

how do you use the environmental variables? can you give an example?

There are some issues, for example, links in emails don’t work. Everything else works fine though and I can login, which is probably a bigger issue than anything else.

---

<div class="post-metadata">

**Author:** ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)\
**Post date:** [April 6, 2021, 9:55am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/6 "2021-04-06T09:55:38Z")

</div>

Docs are finally updated, they should help you:  
[https://docs.zammad.org/en/latest/install/docker-compose/environment.html](https://docs.zammad.org/en/latest/install/docker-compose/environment.html)

Everything else docker-compose specific is out of my scope and should be covered by their docs.

* * *

> [@technoicon](#):
>
> There are some issues, for example, links in emails don’t work

Please have a look into your system settings…

 ![image](https://community.zammad.org/uploads/default/original/2X/f/fe615e189bcb2bfe043e855c11cf83afd296e148.png)

---

<div class="post-metadata">

**Author:** ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)\
**Post date:** [August 4, 2021, 9:55am UTC](https://community.zammad.org/t/csrf-token-verification-failed-docker-nginx-zammand-conf/6212/7 "2021-08-04T09:55:46Z")

</div>

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.
