422: The change you wanted was rejected for Office 365 login

Infos:

  • Used Zammad version: 5.0.3-14
  • Used Zammad installation type: docker-compose
  • Operating system: Ubuntu 20.04
  • Browser + version: All browsers (Chrome, Edge Firefox)
  • Docker is using Traefik as Reverse Proxy.

Expected behavior:

Clicking the “Office 365” button prompts to login with Office365 and login is granted when the correct credentials are inserted

Actual behavior:

Zammad immediately gives you the following error:
class=“error-message”<% end %>>
422: The change you wanted was rejected.
<% if @message.present? %>
<%= @message %>
<% end %> <% if !@traceback %>

It is the same in all web browsers and incognito mode.
It does not matter if you’re already logged in with Office 365 or not.

Steps to reproduce the behavior:

Enable M365 in the Security settings and fill the required information for Client ID and Client Secret.
Try logging in with the Office 365 button.
I know the Application in Azure is correctly configured as I used it before in a K8S setup, but we later decided against it in favor of Docker.

I have searched other similar issues in this forum but non of the suggested issues have helped.
docker-compose.override.yml file: Zammad docker-compose.override.yml - Pastebin.com

Finally found the solution myself.
Found this thread in github: CSRF Token error on login since upgrading to 3.2 · Issue #120 · zammad/zammad-docker-compose · GitHub

Create your own zammad.conf file in your docker server and map it to nginx from the docker-compose.override.yml. Like in the Github thread.

Add his configuration to your zammad.conf file but you need to also add the following row:
proxy_set_header X-Forwarded-SSL on;

My full zammad.conf:

#
# this is the nginx config for zammad
#

upstream zammad-railsserver {
    server zammad-railsserver:3000;
}

upstream zammad-websocket {
    server zammad-websocket:6042;
}

server {
    listen 80;

    # replace 'localhost' with your fqdn if you want to use zammad from remote
    server_name _;

    root /opt/zammad/public;

    access_log /dev/stdout;
    error_log  /dev/stdout;

    client_max_body_size 50M;

    location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
        expires max;
    }

    location /ws {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header CLIENT_IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_read_timeout 86400;
        proxy_pass http://zammad-websocket;
    }

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header CLIENT_IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-SSL on;
        proxy_read_timeout 300;
        proxy_pass http://zammad-railsserver;

        gzip on;
        gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
        gzip_proxied any;
    }
}

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