javascript - PDF.js CORS issue -
i'm having issue pdf.js , cors configuration.
from domain i'm loading pdf.js iframe file parameter (full path server, return pdf document). pdf.js create request server @ domain b origin: domain a
. server @ domain b returns pdf document header access-control-allow-origin: domain a
, far good.
in network tab see request server, returning 200 status ok, pdf.js throwing error unexpected server response (0) while retrieving pdf <url>
.
the question is, what's going on here, cors seems ok, can't more info pdf.js real reason pdf failing load. there encountered same?
finally found problem. server not passing access-control-allow-credentials: true
header response, needed (xhr request sent xhr.withcredential
).
cors working properly.
found solution at: https://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/
Comments
Post a Comment