Fetching dicoms with dicomweb-client package and Nginx reverse proxy on orthanc

This is my nginx configuration: `server {
listen 80;
server_name localhost;

    #charset koi8-r;

    access_log  logs/host.access.log  main;

    # location / {
    #     root   html;
    #     index  index.html index.htm;
    # }

 location / {
        proxy_http_version 1.1;

  		proxy_pass http://127.0.0.1:8042/dicom-web/;
        proxy_set_header HOST $host;
        proxy_set_header X-Real-IP $remote_addr;
        # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        # proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Accept $http_accept;

        # add_header Accept 'multipart/related';
        # add_header Content-Type 'multipart/related';

    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Headers' 'DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, Accept';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Origin' '*' always;

}`

export const createImageIdsAndCacheMetadata = async ({
  StudyInstanceUID,
  SeriesInstanceUID,
  SOPInstanceUID = null,
  orthancRoot,
}: Props) => {
  const SOP_INSTANCE_UID = "00080018";
  const SERIES_INSTANCE_UID = "0020000E";
  const MODALITY = "00080060";

  const studySearchOptions = {
    studyInstanceUID: StudyInstanceUID,
    seriesInstanceUID: SeriesInstanceUID,
  };

  const client = new api.DICOMwebClient({ url: orthancRoot as string, singlepart: true });

  const instances = await client.retrieveSeriesMetadata(studySearchOptions);
  const modality = instances[0][MODALITY].Value[0];

  let imageIds = instances.map((instanceMetaData) => {
    const SeriesInstanceUID = instanceMetaData[SERIES_INSTANCE_UID].Value[0];

    const SOPInstanceUIDToUse =
      SOPInstanceUID || instanceMetaData[SOP_INSTANCE_UID].Value[0];

    const prefix = "wadors:";

    const imageId =
      prefix +
      orthancRoot +
      "/studies/" +
      StudyInstanceUID +
      "/series/" +
      SeriesInstanceUID +
      "/instances/" +
      SOPInstanceUIDToUse +
      "/frames/1";

    cornerstoneDICOMImageLoader.wadors.metaDataManager.add(
      imageId,
      instanceMetaData
    );
    return imageId;
  });
 return imageIds
  }
async function prefetchMetadataInformation(imageIdsToPrefetch: string[]) {
  for (let i = 0; i < imageIdsToPrefetch.length; i++) {
    try {
      console.log(`Attempting to load image ID: ${imageIdsToPrefetch[i]}`);
      const image = await cornerstoneDICOMImageLoader.wadouri.loadImage(imageIdsToPrefetch[i]).promise;
      console.log(`Successfully loaded image: ${imageIdsToPrefetch[i]}`);
    } catch (error) {
      console.error(`Error loading image ID: ${imageIdsToPrefetch[i]}`, error);
    }
  }
}
 const imageIds = await createImageIdsAndCacheMetadata({
      StudyInstanceUID:
        '1.3.76.8.2199.1082166.6106066',
      SeriesInstanceUID:
        '1.3.12.2.1107.5.8.15.999999.30000017071908265206000003357',
      orthancRoot: "http://localhost",
    });

    await prefetchMetadataInformation(imageIds);

Everytime I fecth, I get error from the prefetchMetadataInformation function Error: “dicomParser.readPart10Header: DICM prefix not found at location 132 - this is not a valid DICOM P10 file.” On the frontend with this url “http://localhost:8042/dicom-web/studies/1.3.76.8.2199.1082166.6106066/series/1.3.12.2.1107.5.8.15.999999.30000017071908265206000003357/instances/1.3.12.2.1107.5.8.15.999999.30000017071908265206000003595/frames/1”.

When I input the url directly into my browser, I get the json object below with that orthanc error. How do I go about these two errors.

{
"Details": "expecting 'Accept: multipart/related' HTTP header",
"HttpError": "Bad Request",
"HttpStatus": 400,
"Message": "Parameter out of range",
"Method": "GET",
"OrthancError": "Parameter out of range",
"OrthancStatus": 3,
"Uri": "/dicom-web/studies/1.3.76.8.2199.1082166.6106066/series/1.3.12.2.1107.5.8.15.999999.30000017071908265206000003357/instances/1.3.12.2.1107.5.8.15.999999.30000017071908265206000003595/frames/1"
}

Some help dissect these two errors please.

Hello,

This error message is not issued by Orthanc. Please get in touch with the developers of the software library that generates this error.

Please provide a minimal working example for reproducing your issue. In this case, you have to provide one sample DICOM file and the exact call you make to Orthanc using the curl command-line tool.

Regards,
Sébastien-