pdf文件下载代码无法使用SSL / HTTPS?

Scenario: I've a link to download a pdf file. Upon clicking it, an ajax call runs and returns the file to download. (Ajax implemented to hide the file path for security reasons)

Problem: The code is working perfect with http/non-ssl path. But when site is moved to https the same code is not working.

Question: Is there any thing which i am missing for SSL/HTTPS into the code? This code is written in to wordpress

 <a  class="red contract-btn" id="contract_link" data-contract="<?php echo base64_encode($cont_file); ?>" href="" >View Contract</a>

 <script>
jQuery("#contract_link").on('click',function(e){  

e.preventDefault();
 var $this=jQuery(this).data('contract'); 
      var ajaxData = {
                'action': 'contract_file_download', 
                'cont_file':$this  
        }

        jQuery.ajax({

            type: "POST",
            url: "<?php echo admin_url('admin-ajax.php'); ?>",
            data: ajaxData, 
            success: function( response ) { },
            error: function() {   
            alert("Error!");
            }

        });
    });

</script>  

PHP:

add_action("wp_ajax_contract_file_download", "contract_file_download");
add_action("wp_ajax_nopriv_contract_file_download", "contract_file_download"); 
function contract_file_download(){
 $File_path=base64_decode($_POST['cont_file']);  
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($File_path) . '"');
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($File_path));

ob_end_flush();   

set_time_limit(0);

readfile($File_path);


    } 

I believe ...I am maybe wrong ... You are maybe not changed all urls inside WordPress properly.

If you did, according to https://codex.wordpress.org/Function_Reference/admin_url

admin_url('admin-ajax.php','https');

use second parameter to force https