Submitting a form causes 'secure connection failed' error that persists
For those who end up in this situation, the reason for this to happen is an error somewhere in your PHP code that is not caught by the PHP interpreter or Drupal itself and the server disconnects to your browser immediately before sending any information (including for example the web server certificate). It is not a network-related error as suggested above here.

To solve the problem, install the xdebug PHP module, configure it and run your scripts again. You will now get far better insight in the cause of the error(s) and it is actually caught before a disconnect.

In my case, the disconnect was caused by a recursion limit hit in my code, which was not caught by the PHP interpreter. Took me a few hours, mostly looking in the wrong direction (network issues, certificate issues).