Merging XFDF using the Express REST API Returns ERROR: code: 26 message: "Origin does not match the domain set on license key"

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
|UI version|‘8.1.0’|
|Core version|‘8.1.1’|
|Build|‘MTAvMjEvMjAyMXw2OGY2MTQ1NWU=’|
|WebViewer Server|false|
|Full API|false|

Detailed description of issue
We recently bought your product.
After adding the keys however we started experiencing an issue where calls to the “api.pdfjs.express/xfdf/merge” endpoint would return: Code: 26 Messager: “Origin does not match the domain set on license key”

We are calling the endpoint from a a subdomain of the domain set in the account settings of the account we bought the licence with.

Expected behaviour
A successful API call returning the { url, key, id }

Does your issue happen with every document, or just one?
Every document. Every call to the API.

Code snippet

const xfdf = await annotationManager.exportAnnotations({ links: false, widgets: false, useDisplayAuthor: true });
const fileData = await docViewer.getDocument().getFileData({});
const blob = new Blob([fileData], { type: ‘application/pdf’ });
const data = new FormData();
data.append(‘xfdf’, xfdf);
data.append(‘file’, blob);
data.append(‘license’, ‘ourclientlicencekey’);
const response = await fetch(‘https://api.pdfjs.express/xfdf/merge’, {
method: ‘post’,
body: data
}).then(resp => resp.json());
const { url, key, id } = response;

Hi a.krueger,

Are you using a proxy by chance?
Can you provide the URL you’re hosting on and the subdomain that is calling the API? (you can DM me if you don’t feel comfortable sending that here)

Best regards,
Tyler

Hi, are there any updates on this ?

Hi Gordon,

do you have a solution for us?

We could really use a fix as this issue is causing us to be unable to use PDF.js Express in a production environment.

In the meantime, I have hosted the static resources for PDF.JS Express on a server specially set up for this purpose.
This is hosted on the domain stored in our profile. (Not on any subdomain) This way, the origin of the request sent from the iFrame to https://api.pdfjs.express/xfdf/merge also corresponds to the domain stored in our profile. Nonetheless, I get the same error.

Would it be possible that the port in the origin of the request is causing this problem?

Hi a.krueger,

Apologies for the delay. Unfortunately, if I am unable to reproduce the issue it is difficult to look deeper into this. We do not encounter this issue normally, which leads me to believe it could be a network issue, or a redirect on your network.

Could you by chance be using a VPN?
Can you provide a HAR file from the Chrome console to look at the request logs?

Best regards,
Tyler

Hi Tyler,
I’ve uploaded a zipped .har file via direct message.