I think the problem is Autoptimize runs before the HTTPS plugin. So the solution would be to make HTTPS run sooner or AO run later. Could you open up wp-content/plugins/autoptimize/autoptimize.php and on line 272 change
add_action('template_redirect','autoptimize_start_buffering',2);
into
add_action('template_redirect','autoptimize_start_buffering',11);
This would make HTTPS (which hooks into template_redirect at priority 9) run before Autoptimize (which is at 2 now). If that doesn't solve the problem, I have some changes in the AO's getpath-function in mind which could also help.
frank