Add header values to AJAX requests in the React PDF Viewer

23 Jul 20261 minute to read

Use the ajaxHeaders property inside the PDF Viewer’s [ajaxRequestSettings] (https://ej2.syncfusion.com/react/documentation/api/pdfviewer/ajaxrequestsettings) to send custom HTTP headers with each request made by the viewer.

Example: Add a custom Authorization header using ajaxRequestSettings in a React component

viewer.ajaxRequestSettings = {
   ajaxHeaders: [
      {
         headerName: "Authorization",
         headerValue: "Bearer 64565dfgfdsjweiuvbiuyhiueygf"
      }
   ],
   withCredentials: false
};

Find the sample how to add custom headers in AjaxRequestSettings