file origin does not match viewer's pdf.js

JavaScript
1. If you're trying to do a crossorigin load you must add your origin in the array
var HOSTED_VIEWER_ORIGINS = ['null', '...', 'yourorigin'];
2. check the protocol from the origin you are getting the resource.
example: 
http://localhost/web/viewer.html?file=https://localhost/xx.pdf
turns into
http://localhost/web/viewer.html?file=http://localhost/xx.pdf
Source

Also in JavaScript: