HTTPS permalinks resulting in 404

You can use template_redirect to force all the http traffic going through WordPress to use https:

function force_secure_navigation() {

    if ( ! is_ssl() ) :

        $url="https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

        wp_redirect( $url, 301 );

        exit();

    endif;

}

add_action( 'template_redirect', 'force_secure_navigation', 1 );

Remember that if you are working with https it’s important to also serve your external resources, such as jQuery, Google Fonts or whatever is loading from a CDN, using https. You might want to check your wp_enqueue_style and wp_enqueue_script hooks to be sure there are no http calls left.