Header forwarding error behind nginx reverse proxy and client validation

I’ve just installed Piwik, whenever I try to log in to it I get the following error:

“Error: Form security failed. Please reload the form and check that your cookies are enabled. If you use a proxy server, you must configure Piwik to accept the proxy header that forwards the Host header. Also, check that your Referrer header is sent correctly.”

The piwik installation is behind a nginx reverse proxy that uses client validation.

I have added the following lines to my config.ini.php [General] section


proxy_client_headers[] = HTTP_X_FORWARDED_FOR
proxy_host_headers[] = HTTP_X_FORWARDED_HOST

In addition to this I have tried adding these:


assume_secure_protocol = 1
force_ssl = 1

I always get the same error