# PDF.js Express Viewer not working via reverse proxies

**URL:** <https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [December 14, 2021, 7:02pm UTC](https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255 "2021-12-14T19:02:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickmyersdt](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/nickmyersdt/32/628_2.png) [@nickmyersdt](https://pdfjs.community/u/nickmyersdt)\
**Post date:** [December 14, 2021, 7:02pm UTC](https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255/1 "2021-12-14T19:02:12Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
@pdftron/pdfjs-express-viewer: 8.1.1

**Detailed description of issue**  
We have replaced react-pdfwith pdfjs-express-viewer on our website [https://edu.digitaltheatreplus.com](https://edu.digitaltheatreplus.com). It is working for most of our customers, except for those that use our website via a reverse proxy (which has a different domain name) for example: [https://edu-digitaltheatreplus-com.eu1.proxy.openathens.net](https://edu-digitaltheatreplus-com.eu1.proxy.openathens.net)

We have examined HAR files from customers, and see that the request to GET /auth.pdfjs.express/  
returns a 200 and a key, however, users do not see the PDF, they see the following:

![Screenshot 2021-12-09 at 23.11.55](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/9bfac5e2ddc625a8faad2f6b69d3b56bf74b7dae.png)

My assumption is that the problem is that the key doesn’t validate the domain/referrer, is that correct? Is there a way to generate a key that allows for the same website to work via reverse proxy/different domains?

Any ideas of advice would be gratefully received, this was implemented by a developer in haste before they left our business, so I’m left with the decision of finding a way to make PDF.js Express Viewer work via reverse proxy, or roll back to our old react-pdf implementation.

**Expected behaviour**  
PDF document is displayed

**Does your issue happen with every document, or just one?**  
Every document when loaded by a reverse proxy (we have about 1500 customers using either OpenAthens, WAM Proxy or EZProxy)

**Link to document**  
Unfortunately they are behind a paywall, also, you’d need to be using a reverse proxy to reproduce issue.

**Code snippet**

```javascript
const PdfViewer = dynamic(
  () => import('../../../media/components/pdf-viewer'),
  { ssr: false }
);
...
        <PdfViewer
            key={[
              guide.media.url,
              printAndDownloadDisabled,
              outlineHidden,
            ].join()}
            pdfUrl={guide.media.url}
            pdfTitle={guide.name}
            disablePrintAndDownload={printAndDownloadDisabled !== 'off'}
            hideOutline={outlineHidden}
          />

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [December 14, 2021, 7:02pm UTC](https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255/3 "2021-12-14T19:02:17Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

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

Guides:
- [Adding your license key](https://pdfjs.express/documentation/get-started-viewer/add-license-key)
- [Integrating PDF.js Express Viewer into an existing Angular project - Prerequisites](https://pdfjs.express/documentation/get-started-viewer/angular/exist-project#prerequisites)
- [PDF.js Express Viewer Overview - What is PDF.js Express Viewer?](https://pdfjs.express/documentation/get-started-viewer#what-is-pdf.js-express-viewer?)

APIs:
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [ExpressUtils(optionsopt) - # async merge() → {Promise.}](https://pdfjs.express/api/utils/ExpressUtils.html#merge__anchor)
- [Adding a download button](https://pdfjs.express/api/utils/tutorial-Adding%20a%20download%20button.html#__anchor)

Forums:
- [Watermark shows for some users](https://pdfjs.community/t/watermark-shows-for-some-users/263/2)
- [Cannot remove watermark, even with license information](https://pdfjs.community/t/cannot-remove-watermark-even-with-license-information/1125/1)
- [Licensing problem in a intranet environmnet](https://pdfjs.community/t/licensing-problem-in-a-intranet-environmnet/1116/1)

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [December 15, 2021, 4:50pm UTC](https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255/4 "2021-12-15T16:50:20Z")

</div>

Hey there!

All requests made to our authentication server must come from the domain/host that is specified on the license key. In your case when using a reverse proxy, the requests no longer come from your configured host which is why the viewer will not load.

I’ll DM you with some things we can do.

Logan

---

<div class="post-metadata">

**Author:** ![tribalhabits](https://avatars.discourse-cdn.com/v4/letter/t/e19b73/32.png) [@tribalhabits](https://pdfjs.community/u/tribalhabits)\
**Post date:** [April 13, 2023, 5:34am UTC](https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255/5 "2023-04-13T05:34:48Z")

</div>

HI there. We have the same issue as this - we allow customers to set a custom domain which is vanity URL over our provided URL. PDF Express has stopped working for those custom domains as the domain differs from the host for our licence key. CAn you please DM us with possible suggestions too. Thanks, David
