• Resolved devcri

    (@devcri)


    Problem: I can’t save content with the new Block Editor (Gutenberg). The Classic Editor works fine. I am seeing a HTTP Status Code 403 in the access logs. Seems like a configuration problem with nginx.

    I am running:
    WordPress Version 5.0.1
    Theme: Twenty Nineteen Version 1.0
    nginx version: nginx/1.10.3 (Ubuntu)
    Using https with letsencrypt certificate

    Example from access.log (nginx):

    # grep '403' access.log
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:47:47 +0100] "GET /wp-json/wp/v2/taxonomies/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor__forget" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:48:08 +0100] "GET /wp-json/wp/v2/media/57/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor__forget" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:48:11 +0100] "GET /wp-json/wp/v2/blocks/?_locale=user&per_page=100 HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor__forget" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:48:49 +0100] "GET /wp-json/wp/v2/taxonomies/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:53:48 +0100] "GET /wp-json/wp/v2/taxonomies/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor__forget" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:54:09 +0100] "GET /wp-json/wp/v2/taxonomies/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:54:10 +0100] "GET /wp-json/wp/v2/taxonomies/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"
    xxx.xxx.xxx.xxx - - [15/Dec/2018:13:54:35 +0100] "GET /wp-json/wp/v2/media/57/?context=edit&_locale=user HTTP/2.0" 403 457 "https://www.../wp-admin/post.php?post=16&action=edit&classic-editor" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15"

    Searching for 403 Status Code I find => “403 Forbidden. The HTTP 403 Forbidden client error status response code indicates that the server understood the request but refuses to authorize it. This status is similar to 401 , but in this case, re-authenticating will make no difference.”

    I found other posts discussing similar problems with Nginx and already changed the nginx configuration to:
    try_files $uri $uri/ /index.php$is_args$args;

    But this didn’t solve the problem. I still can’t save with the new Block Editor. Switching back to classic editor and everything works fine. Switching back to Gutenberg Block-Editor and it refuses to save.

    Flushing caches didn’t help.

    I also installed the Health Check Plugin and deactivated all Plugins via Trouble Solving. Didn’t help.
    Health Check Plugin show everywhere green checkmarks (also with REST API availability) except for PHP-Version, which is 7.0.32-0ubuntu0.16.04.1 (here it shows a yellow dash and a recommendation to upgrade to 7.2)

    Do you have any advice on how to configure nginx + letsencrypt to work with Gutenberg?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Huh. 403 error?

    I also have nginx, Let Encrypt and WordPress 5.0.1 and use the editor without that problem.

    *Looks*

    I’m posting my confs here as there may be something there that works for you. Try and do a stare and compare before changing anything on your setup. Also as you know, backups are your friend.

    I’m on Ubuntu 18.04.1 LTS with PHP Version 7.2.10-0ubuntu0.18.04.1 as php-fpm.

    Here’s the file I use for my site in /etc/nginx/sites-available/ for the non-TLS version. The listen 443 is at the end. It’s symlinked to /etc/nginx/sites-enabled/

    
    server {
    	listen 80;
    
    	root /var/www/vhosts/dembowski.net;
    
    	server_name dembowski.net *.dembowski.net;
    
    	client_max_body_size 500M;
    
    	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    	add_header X-Content-Type-Options nosniff;
    	add_header X-XSS-Protection "1; mode=block";
    	add_header X-Frame-Options "SAMEORIGIN";
    	add_header Referrer-Policy "no-referrer-when-downgrade";
    	add_header Vary "Accept-Encoding";
    	# add_header Content-Security-Policy "default-src https";
    
    	gzip on;
    	gzip_min_length 1100;
    	gzip_buffers 4 32k;
    	gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
    	gzip_vary on;
    
    	index index.php index.html;
    
    	location ~ ^/\.user\.ini {
    		deny all;
    	}
    
    	location / {
    
    		try_files $uri $uri/ /index.php?$args;
    
    	}
    
    	location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    		# Some basic cache-control for static files to be sent to the browser
    		expires max;
    		add_header Pragma public;
    		add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    		add_header Vary "Accept-Encoding";
    	}
    
    	# Directives to send expires headers and turn off 404 error logging.
    	location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    		expires 24h;
    		log_not_found off;
    		add_header Vary "Accept-Encoding";
    		gzip on;
    	}
    
    	include /etc/nginx/php-fpm.conf;
    
    	listen 443 ssl http2; # managed by Certbot
    	ssl_certificate /etc/letsencrypt/live/dembowski.net/fullchain.pem;
    	ssl_certificate_key /etc/letsencrypt/live/dembowski.net/privkey.pem;
    	include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    	ssl_dhparam /etc/letsencrypt/ssl-dhparams-4096.pem; # managed by Certbot
    
    	if ($scheme != "https") {
    		return 301 https://$host$request_uri;
    	} # managed by Certbot
    
    }
    

    There’s probably more in there than is necessary. I separated /etc/nginx/php-fpm.conf because I’ve several hosts and editing that in many places was a pain.

    That file looks like this. Depending on my mood (seriously) I vary fastcgi_pass from a localhost listener or a unix: socket.

    
    location ~ \.php$ {
    
    	fastcgi_split_path_info ^(.+\.php)(/.+)$;
    	try_files $uri =404;
    	#fastcgi_pass 127.0.0.1:9000;
    	fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    	fastcgi_param WP_NGINX_CONFIG done;
    	fastcgi_index index.php;
    	include fastcgi_params;
    
    }
    
    Thread Starter devcri

    (@devcri)

    Thank you very much for your reply and especially confirming that Gutenberg should work with nginx and Let’s Encrypt. While trying out the configuration settings you posted I stumbled upon a configuration line in my config file that would add a slash to the end of each url that didn’t contain a dot:

    rewrite ^([^.]*[^/])$ $1/ permanent;

    That line was the culprit. After commenting out this line and restarting nginx Gutenberg worked.

    Thank you very much!!!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I’m glad you sorted it out. ??

    Norm

    (@casualmagic)

    I was having a similar issue. But with adding the trailing slash from the htaccess file. Do you know why this would cause the editor to not save? I wasn’t able to find any error logs that pointed to this being the problem.

    Thanks.

    My site was made using a (Urline) theme that included wp bakery. I then used gutenberg to make posts as easiest for staff to use. However, since latest update ( wp5.2.3) the gutenberg editor will not save. I now have classic editor installed so can write and save blogs but very basic looking and can no longer use the nice pullquotes etc that I had originally been using.

    • This reply was modified 5 years, 2 months ago by rozsarak.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Block-Editor (Gutenberg) not saving (nginx + letsencrypt + WordPress 5.0.1)’ is closed to new replies.