Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE9 cross request to AWS S3 pdf #163

Open
contiero-roberto opened this issue Jul 20, 2015 · 10 comments
Open

IE9 cross request to AWS S3 pdf #163

contiero-roberto opened this issue Jul 20, 2015 · 10 comments

Comments

@contiero-roberto
Copy link

Hi.
In my project (suppose that it is hosted on www.example.com) I'm trying to use pdf.js to view a pdf downloaded from Amazon S3 in Internet Explorer 9. This is the CORS setted into the bucket:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <ExposeHeader>Accept-Ranges</ExposeHeader>
        <ExposeHeader>Content-Encoding</ExposeHeader>
        <ExposeHeader>Content-Length</ExposeHeader>
        <ExposeHeader>Content-Range</ExposeHeader>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

In the root of that bucket I have putted this proxy.html:

<!DOCTYPE html>
<html>
<head>
    <title>XDomain Proxy - Slave</title>
    <script src="//cdn.rawgit.com/jpillora/xdomain/0.7.3/dist/xdomain.min.js" data-master="*"></script>
</head>
<body></body>
</html>

In the viewer.js hosted on www.example.com I have putted these lines:

    <!--[if IE 9]>
    <script src="//cdn.rawgit.com/jpillora/xdomain/0.7.3/dist/xdomain.min.js"></script>
    <script>
      xdomain.debug = true;
      xdomain.slaves({
        'https://my-bucket.s3-eu-west-1.amazonaws.com': '/proxy.html'
      });
    </script>
    <![endif]-->    

With this configuration in IE9 I get this error, while with Firefox and Chrome the pdf is opened properly:

LOG: xdomain (https://XXX.XXX.XXX.XXX): adding slave: https://my-bucket.s3-eu-west-1.amazonaws.com
LOG: Warning: Setting up fake worker.
LOG: xdomain (https://XXX.XXX.XXX.XXX): proxying request to slave: 'https://my-bucket.s3-eu-west-1.amazonaws.com'
LOG: xdomain (https://XXX.XXX.XXX.XXX): creating iframe xdomain-f4d1ebaf
LOG: xdomain (https://XXX.XXX.XXX.XXX): new socket: xdomain-bf099a26
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26: ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-bf099a26: request
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26: XD_CHECK -> [object Object]
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-bf099a26: ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): ready socket: xdomain-bf099a26 (emit #1 pending)
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26: xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26: xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26: response
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-bf099a26: close
LOG: xdomain (https://XXX.XXX.XXX.XXX): close socket: xdomain-bf099a26
LOG: xdomain (https://XXX.XXX.XXX.XXX): proxying request to slave: 'https://my-bucket.s3-eu-west-1.amazonaws.com'
LOG: xdomain (https://XXX.XXX.XXX.XXX): new socket: xdomain-ed1314d8
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8: ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-ed1314d8: request
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8: XD_CHECK -> [object Object]
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-ed1314d8: ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): ready socket: xdomain-ed1314d8 (emit #1 pending)
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8: xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8: xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8: response
SCRIPT5007: Unable to get value of the property 'byteLength': object is null or undefined
pdf.worker.js, line 2285 character 7

My pdf.js version is:

PDFJS.version = '1.1.215';
PDFJS.build = 'c9a7498';

Is there any error in my configuration?
Thanks for your support.

Roberto

@jpillora
Copy link
Owner

SCRIPT5007: Unable to get value of the property 'byteLength': object is
null or undefined

I think it won't work because IE9 doesn't support array buffer

On Tuesday, July 21, 2015, Roberto Contiero notifications@github.com
wrote:

Hi.
In my project (suppose that it is hosted on www.example.com) I'm trying
to use pdf.js to view a pdf downloaded from Amazon S3 in Internet Explorer
9. This is the CORS setted into the bucket:

_ GET 3000 Accept-Ranges Content-Encoding Content-Length Content-Range _

In the root of that bucket I have putted this proxy.html:

<title>XDomain Proxy - Slave</title> <script src="//cdn.rawgit.com/jpillora/xdomain/0.7.3/dist/xdomain.min.js" data-master="*"></script>

In the viewer.js hosted on www.example.com I have putted these lines:

<!--[if IE 9]>
<script src="//cdn.rawgit.com/jpillora/xdomain/0.7.3/dist/xdomain.min.js"></script>
<script>
  xdomain.debug = true;
  xdomain.slaves({
    'https://my-bucket.s3-eu-west-1.amazonaws.com': '/proxy.html'
  });
</script>
<![endif]-->

With this configuration in IE9 I get this error, while with Firefox and
Chrome the pdf is opened properly:

LOG: xdomain (https://XXX.XXX.XXX.XXX): adding slave:
https://my-bucket.s3-eu-west-1.amazonaws.com
LOG: Warning: Setting up fake worker.
LOG: xdomain (https://XXX.XXX.XXX.XXX): proxying request to slave: '
https://my-bucket.s3-eu-west-1.amazonaws.com'
LOG: xdomain (https://XXX.XXX.XXX.XXX): creating iframe xdomain-f4d1ebaf
LOG: xdomain (https://XXX.XXX.XXX.XXX): new socket: xdomain-bf099a26
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26:
ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-bf099a26:
request
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26:
XD_CHECK -> [object Object]
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-bf099a26:
ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): ready socket: xdomain-bf099a26
(emit #1 #1 pending)
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26:
xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26:
xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-bf099a26:
response
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-bf099a26:
close
LOG: xdomain (https://XXX.XXX.XXX.XXX): close socket: xdomain-bf099a26
LOG: xdomain (https://XXX.XXX.XXX.XXX): proxying request to slave: '
https://my-bucket.s3-eu-west-1.amazonaws.com'
LOG: xdomain (https://XXX.XXX.XXX.XXX): new socket: xdomain-ed1314d8
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8:
ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-ed1314d8:
request
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8:
XD_CHECK -> [object Object]
LOG: xdomain (https://XXX.XXX.XXX.XXX): send socket: xdomain-ed1314d8:
ready
LOG: xdomain (https://XXX.XXX.XXX.XXX): ready socket: xdomain-ed1314d8
(emit #1 #1 pending)
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8:
xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8:
xhr-event -> readystatechange
LOG: xdomain (https://XXX.XXX.XXX.XXX): receive socket: xdomain-ed1314d8:
response
SCRIPT5007: Unable to get value of the property 'byteLength': object is
null or undefined
pdf.worker.js, line 2285 character 7

My pdf.js version is:

PDFJS.version = '1.1.215';
PDFJS.build = 'c9a7498';

Is there any error in my configuration?
Thanks for your support.

Roberto


Reply to this email directly or view it on GitHub
#163.

@contiero-roberto
Copy link
Author

Hi Jaime,
if I put the pdf on my server and remove XDomain library (specifically remove this code

    <!--[if IE 9]>
    <script src="//cdn.rawgit.com/jpillora/xdomain/0.7.3/dist/xdomain.min.js"></script>
    <script>
      xdomain.debug = true;
      xdomain.slaves({
        'https://my-bucket.s3-eu-west-1.amazonaws.com': '/proxy.html'
      });
    </script>
    <![endif]-->    

from viewer.html), it works. So, I think that there is a problem with XDomain and pdf.js. Do you have a use case where XDomain is used with pdf.js and the pdf file is downloaded from S3 using a cross domain request (obviously that works in IE9)?

@jpillora
Copy link
Owner

Does pdf.js use a flash fallback for IE9?

@MicheleMas
Copy link

I can answer this question, pdf.js uses only javascript, also with IE9 (JS polyfill for HTML5 missing features https://github.com/mozilla/pdf.js/blob/master/web/compatibility.js ).

Michele

@contiero-roberto
Copy link
Author

Hi Jaime,
@MicheleMas is my collegue and, as he said, pdf.js doesn't use flash fallback in IE9. Have you any idea or suggestion about this problem?

@jpillora
Copy link
Owner

Hi Roberto, sorry I'm not able to tell what's going wrong. Maybe you could
make a small demo live reproducing this and I'll try to debug it when I get
some free time?

On Tuesday, July 28, 2015, Roberto Contiero notifications@github.com
wrote:

Hi Jaime,
@MicheleMas https://github.com/MicheleMas is my collegue and, as he
said, pdf.js doesn't use flash fallback in IE9. Have you any idea or
suggestion about this problem?


Reply to this email directly or view it on GitHub
#163 (comment).

@contiero-roberto
Copy link
Author

Hi Jaime,
I prepared for you a demo case at this address:
http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com
In this bucket there is a simple pdf-js viewer that downloads a pdf from another bucket (https://pdf-repository.s3-eu-west-1.amazonaws.com). As I said in my previous post, with IE9 I get this error:

LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): adding slave: https://pdf-repository.s3-eu-west-1.amazonaws.com 
LOG: Warning: Setting up fake worker. 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): proxying request to slave: 'https://pdf-repository.s3-eu-west-1.amazonaws.com' 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): creating iframe xdomain-bb90c6a3 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): new socket: xdomain-daf8e9d4 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: ready 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-daf8e9d4: request 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: XD_CHECK -> [object Object] 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-daf8e9d4: ready 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): ready socket: xdomain-daf8e9d4 (emit #1 pending) 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: xhr-event -> readystatechange 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: xhr-event -> readystatechange 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: response 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-daf8e9d4: close 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): close socket: xdomain-daf8e9d4 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): proxying request to slave: 'https://pdf-repository.s3-eu-west-1.amazonaws.com' 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): new socket: xdomain-6ef70217 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: ready 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-6ef70217: request 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: XD_CHECK -> [object Object] 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-6ef70217: ready 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): ready socket: xdomain-6ef70217 (emit #1 pending) 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> readystatechange 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> readystatechange 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: response 
SCRIPT5007: Unable to get value of the property 'byteLength': object is null or undefined 
example.pdf, line 1 character 1
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> readystatechange 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> load 
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> loadend 

Thank you so much for all your help and time.
By

Roberto

@jpillora
Copy link
Owner

Hi Roberto, thanks for putting together the demo - I'll check it out tonight

On Wed, Jul 29, 2015 at 3:31 PM, Roberto Contiero notifications@github.com
wrote:

Hi Jaime,
I prepared for you a demo case at this address:
http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com
In this bucket there is a simple pdf-js viewer that download a pdf from
another bucket (https://pdf-repository.s3-eu-west-1.amazonaws.com). As I
said in my previous post, with IE9 I get this error:

LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): adding slave: https://pdf-repository.s3-eu-west-1.amazonaws.com
LOG: Warning: Setting up fake worker.
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): proxying request to slave: 'https://pdf-repository.s3-eu-west-1.amazonaws.com'
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): creating iframe xdomain-bb90c6a3
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): new socket: xdomain-daf8e9d4
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: ready
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-daf8e9d4: request
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: XD_CHECK -> [object Object]
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-daf8e9d4: ready
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): ready socket: xdomain-daf8e9d4 (emit #1 pending)
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: xhr-event -> readystatechange
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: xhr-event -> readystatechange
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-daf8e9d4: response
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-daf8e9d4: close
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): close socket: xdomain-daf8e9d4
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): proxying request to slave: 'https://pdf-repository.s3-eu-west-1.amazonaws.com'
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): new socket: xdomain-6ef70217
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: ready
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-6ef70217: request
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: XD_CHECK -> [object Object]
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): send socket: xdomain-6ef70217: ready
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): ready socket: xdomain-6ef70217 (emit #1 pending)
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> readystatechange
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> readystatechange
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: response
SCRIPT5007: Unable to get value of the property 'byteLength': object is null or undefined
example.pdf, line 1 character 1
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> readystatechange
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> load
LOG: xdomain (http://pdfjs-viewer.s3-website-eu-west-1.amazonaws.com): receive socket: xdomain-6ef70217: xhr-event -> loadend

Thank you so much for all your help and time.
By

Roberto


Reply to this email directly or view it on GitHub
#163 (comment).

@jpillora
Copy link
Owner

Attempted to debug on saucelabs though its quite limiting. Will try again when I'm at a windows 7 VM.

@contiero-roberto
Copy link
Author

I saw your debug session video. If you need a virtualBox VM with IE9, you can download it from here:
https://www.modern.ie/it-it/virtualization-tools

Roberto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants