If you get a 502 error when you try to edit with Elementor you have to do two things:
Go to Elementor > Settings > Advanced, and under 'Editor Loader', enable 'Switch front-end editor loader method'.
This setting changes the Elementor editor loader method.
You then may need to increase a particular Apache service limit. To do that, add the following lines inside the website's .htaccess file:
<IfModule mod_substitute.c> SubstituteMaxLineLength 10M </IfModule>
You can edit that file via SSH, FTP, or the File Manager tool in cPanel.