Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
How to enable mixed content into your Next.js app with 3rd party npm

My web app is HTTPS but the targeted resource is HTTP. As a result, facing mixed-content issue:

Mixed Content: The page at 'https://app-website-dev.shikho.net/student/video-archive/a74c812b-82dd-417c-b07e-c4544911acac' was loaded over HTTPS, but requested an insecure resource 'http://res.cloudinary.com/cross-border-education-technologies-pte-ltd/image/upload/v1643522121/eofmak1yhic4n8chsrlo.pdf'. This request has been blocked; the content must be served over HTTPS.

I can fix the issue from browser settings but want something inside the code instead of from browser GUI (as all the users are not technical on this site).

How can I achieve this from the code level? So far I've visited CSP: block-all-mixed-content. Maybe something like syntax Content-Security-Policy: block-all-mixed-content; has to use in code?

Here is my code:

import React from "react";
import Viewer, { Worker } from "@phuocng/react-pdf-viewer";
import "@phuocng/react-pdf-viewer/cjs/react-pdf-viewer.css";

function StdPDFViewer({ url }) {
  return (
    <div
      className="pdf-container"
      style={{
        backgroundColor: "aliceblue",
        border: "1px solid rgba(0, 0, 0, 0.3)",
        display: "flex",
        flexDirection: "column",
        height: "100%"
      }}
    >
      <Worker workerUrl="https://unpkg.com/pdfjs-dist@2.5.207/build/pdf.worker.min.js">
        <div id="pdfViewer" style={{ height: "100vh" }}>
          <Viewer
            fileUrl={url}
            defaultScale={1}
            httpHeaders={{ key: "C6590A86-50504136-B572A792-D36E0771" }}
            withCredentials={true}
          />
        </div>
      </Worker>
    </div>
  );
}

export default StdPDFViewer;

I'm using React-PDF-Viewer where the documentation has options like httpHeaders

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!