title: PDF.js: file origin does not match viewer's
body: <p>I am trying to serve PDF files from a bucket on Amazon-S3, using PDF.js in the browser. I have amended the relevant CORS policy in S3. However, I am receiving the following error message in the browser:</p>
  <pre><code>PDF.js v2.2.71 (build: 80135378)
  Message: file origin does not match viewer's
  </code></pre>
  <p>After a search, I have found several related questions, <a href="https://stackoverflow.com/questions/37378251/load-pdf-on-foreign-url-with-pdf-js">such as this question here</a>, as this appears to be a relatively common issue. It is fairly obvious therefore that I need to allow Amazon S3 as a host origin. Therefore, I amend my <code>viewer.js</code> file to include the host, like so:</p>
  <pre><code>var HOSTED_VIEWER_ORIGINS = ['null', 
  'http://mozilla.github.io', 
  'https://mozilla.github.io', 
  'https://thepdfbucket.s3.eu-west- 
  2.amazonaws.com'];
  </code></pre>
  <p>However, if I do a hard reload and inspect sources, I can see that the error is thrown in <code>webpack:///web/app.js</code>:</p>
  <pre><code>Uncaught (in promise) Error: file origin does not match viewer's
  at validateFileURL (app.js:1482)
  at webViewerInitialized (app.js:1541)
  </code></pre>
  <p>If I examine <code>app.js</code>, I can see the <code>HOSTED_VIEWER_ORIGINS</code> array, mapped from the <code>viewer.js</code> file. However, it does not include the amended array, i.e. my addition of <code>https://thepdfbucket.s3.eu-west-2.amazonaws.com</code>.</p>
  <p>I cannot get this to work. I believe I probably have a cache issue, however, I have cleared all the browser's cache, I have even built <code>PDF.js</code> again from <code>github</code> and tried to amend the <code>viewer.js</code> file, prior to compilation.</p>
  <p>If I have amended the <code>viewer.js</code> file, and <code>app.js</code> is mapped from <code>viewer.js</code>, but it does not reflect the recent changes, my conclusion is that it must be using a cached file. How do I clear this cache, and get <code>app.js</code> to reflect the changes I have made?</p>
  <p>I really would appreciate any help here, as I've spent the whole of yesterday on this issue, and I cannot get my head around how this all fits together.</p>
  <p>Many Thanks.</p>