Nextcloud error: “access forbidden CSRF check failed”

### reproduce step

1. Log in with any user

2. Try to exit

3. Error

### expected behavior

user should log out.

Nextcloud report error :”Access forbidden CSRF check failed”

Nextcloud to configure Nginx cross-region solution

### actual behavior

user clicks logout with error:

“Access forbidden

CSRF check failed”

### solution (configure nginx)

1. The first part is to mapmap in the HTTP in the global configuration (default path /etc/nginx/nginx.conf);

First configure nginx.conf add HTTP map

vi /etc/nginx/nginx.conf

# added to HTTP save

map $http_upgrade $connection_upgrade { 
    default upgrade; '' close; 
}

2. The second part, it is the corresponding nextcloud configuration file (create/etc/nginx/conf. D/nextcloud. Conf) under the server IP configuration.

Configure nextcloud.conf inverse configuration file by adding

vi/etc/nginx/conf. D/nextcloud. Conf

proxy_set_header Host $http_host; 

proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Upgrade $http_upgrade; 

proxy_set_header Connection $connection_upgrade;


After

configuration is completed, run nginx-t to check, and confirm that there is no error, run nginx-s reload or systemctl restart nginx to restart nginx for effective configuration.


3. After completion, visiting Nextcloud again may appear: reverse proxy domain is not in the trusted_domain of Nextcloud your visiting domain is not in the trusted domain of Nextcloud
#

modify $nextcloud/config/config in PHP trusted_domains parameters can

Read More: