Matomo behind NginxWeb and NginxApp (Unit)


I am trying to install the latest version of Matomo in our Nginx / Unit stack. I received an error message but cannot find the problem.

After successful installation I got the typical Matomo login page. I use the correct credentials and submit the form. Now the registration page is reloaded from “/” to “/? Module = Login” and the registration form suddenly contains the registration form … so I now have a registration page with two registration forms.

I have analyzed the call to the registration form and received the following 403 return:

Error: Form security failed. Please reload the form and check whether your cookies are activated. If you use a proxy server, you must configure Matomo to accept the proxy header that forwards the host header. Also check that your referrer header has been sent correctly.

The message contains a link to the FAQ - Installation FAQ - Analytics Platform - Matomo - but the information described is sent from the top-level Nginx web server to the device and the PHP 74 interpreter on my phpinfo ().

The cookie used is correct and the CSRF token used is also correct.

I activate the debug function, but I don’t get any information about this error …

Now I’m a little tired and hope that you can help me find the problem.

best regards

Ok, in our setup it had to remove/change the header of “Referrer-Policy ‘no-referrer’;” and define the proxy header in matomo config.ini.php like this;

proxy_client_headers[] = HTTP_X_REAL_IP
proxy_host_headers[] = HTTP_X_FORWARDED_HOST
assume_secure_protocol = 1
force_ssl = 1