URL.createObjectURL() providing url that redirects to 404 in AWS production env

I have a django application deployed on AWS EBS. I have a function that takes a blob and create URL of it so that I can download the pdf file from the site. The function is working perfectly on localhost but in prod environment the created url from URL.createObjectURL() is redirecting to the error page or 404 page. Im using nginx as the reverse proxy. I have checked the blob is valid and the django function is generating the pdf layout correctly. Below is my js code to build the pdf download link

function showFile(blob){
 
  var newBlob = new Blob([blob], {type: "application/pdf"})
  if (!newBlob) {
    console.error("Blob object is not valid");
    return;
  }

  // Create a link pointing to the ObjectURL containing the blob.
  const data = window.URL.createObjectURL(newBlob);
  console.log(data)
  var link = document.createElement('a');
  link.href = data;
  link.open="file.pdf";
  link.download = 'Calculation.pdf';
  link.click()
}

the console.log(data) is returning https://<mydomain>/d6527ea6-5c1d-457a-bfb2-2b6aff01ae31

Any idea on how I can make it work in my prod env?

Thank you

I tried to log the flow and everything is returning correctly. So I am not sure what is the issue