Local domain + port; licenseKey not recognised

Our development site runs off a domain, rather than localhost: however the licenseKey I have set up for the local domain isn’t being recognised as valid.

Eg: the development domain is of the format http://sub.domain.local:4001 - I tried setting the domain as both domain.local and including the port number with domain.local:4001 in the license-key settings … but neither worked. I still got the “a valid license key is required…” error in the web-app (waited the 10 minutes suggested by the Profile Page).

Is this a known issue, something missing in the express-viewer config or …?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

I can also confirm that the https://auth.pdfjs.express/?key=3TTJs6JPhTPovwvLL84v&r=1 request is happening in the console, returning a 200.

Hi Andrew,

Unfortunately we don’t support custom local domains.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

@zserviss To be clear: we’re talking about the .local part of the URL? Is this something you ever intend supporting? What domains are supported then? It seems a little odd you would even check if a domain is valid or not - why would pdfexpress care if domain.local is a real domain or not? It’s just a proxy back to localhost (thanks to /etc/hosts)

Unfortunately this means we will not be able to use pdf.jsexpress given we won’t be able to properly develop with it. Seems like an oversight that it explicitly won’t accept custom domains?? This software would otherwise serve the purposes we were looking for.

Hey there,

I just tested this on my end and was able to make it work with a custom local domain. I set my Express Viewer Key to be domain.local and then set up /etc/hosts to contain 127.0.0.1 domain.local and it was able to read the key correctly.

Couple things to try:

  • If you are using a proxy, make sure that it is not altering the origin of the request or any other headers
  • Make sure you are waiting the 10 mins after changing your key

If you still cannot get it working, try creating a new key with the domain set as domain.local (do not include the port).

Thanks,

Logan Bittner,
Head of Web Applications


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Can you please also recognise 127.0.0.1 as local domain instead of only localhost?
For some reasons we need to use the ip address, which is not being recognised as local dev environment.

Hi @Maximilian.beck,

We can implement that feature. I will add it to our backlog and will let you know through this thread when it has been fixed.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

1 Like

Hi @Maximilian.beck,

Just letting you know that this issue should be fixed.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Thanks for your prompt action :slightly_smiling_face::+1:

Hi,
I am having a similar problem. Running PDF.js on localhost and on an internal VM with a key created for the internal server name no domain existing, i.e. “sdevmultweb.local”. I also confirm that the https://auth.pdfjs.express/?key=xxxxxx request is happening in the console, returning a 200. There is no error in the console that the key is not valid. On both enviroments there is still the watermark.

My code:

WebViewer({
        path: 'lib',
        licenseKey: 'xxxxxx',
    }, viewerElement).then(instance => {
        instance.UI.loadDocument(base64ToBlob(base64Content), { filename: fileName, extension: 'pdf' });

|UI version|‘8.7.0’|
|Core version|‘8.7.0’|
|webviewer.min.js|‘8.7.0’|

Integration of PDF Express is in a Blazor Server UI.
Should the license key alos passed in the load documents?
When I completly remove the key, also no error is shown in the console.

Thanks for your suggestions and regards,
Peter

Hi @peter.homberger,

The watermark will persist in localhost.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

I understand, but what about internal VMs with an URL like this → http://sdevmultweb0682.local:8000/

Can you check your browsers log to see if Express recognizes it as a localhost?

It’ll say something along the lines of ‘Development environment detected… this key is licensed to {domain name}’. If it doesn’t, then the key doesn’t match the domain the request is coming from.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

There are no messages in the console, except the deprecated warning:

Looks like the domain doesn’t match the request domain. Please update your license key domain to match the request domain.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

I tried before all three options for the key:
sdevmultweb0682.spsde.local
sdevmultweb0682.spsde
sdevmultweb0682

None of them worked. Also tried to put an entry in the etc/host without success. Can you please give me an advice how you can see the missmatch and how it should be?

Thanks in advance,
Peter

Just to confirm, this is only in your local environment?

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

This is internal company enviroment with different stages → dev, integration and production

I see. The watermark will persist in localhost so it’s expected in a dev environment.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.