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

Unable to load ROOT file (suspect: https) #189

Closed
alexandertuna opened this issue Sep 4, 2019 · 9 comments
Closed

Unable to load ROOT file (suspect: https) #189

alexandertuna opened this issue Sep 4, 2019 · 9 comments

Comments

@alexandertuna
Copy link

alexandertuna commented Sep 4, 2019

Hi jsroot developers. I have a question about loading a ROOT file into the online display. For example, if I go here:

https://jsroot.gsi.de/latest/?file=https://atlas-bb5.cern.ch/bb5_web/files/run_1565946687003.hist.root

It fails, and I'm told "Read docu how to open files from other servers.", even though https://atlas-bb5.cern.ch/bb5_web/files/run_1565946687003.hist.root is a legitimate file which I can download and view by hand.

I was wondering if you had this experience before. I suspect it is related to our website (atlas-bb5.cern.ch) recently moving from http to https, but I don't understand how this affects the jsroot side.

Thanks for any help,

Alex

cc @sezata @grabanal

@linev
Copy link
Member

linev commented Sep 4, 2019

Hi Alex,

Problem is CORS - Cross Origin Requests. They are blocked by default in the browsers:

https://github.com/root-project/jsroot/blob/master/docs/JSROOT.md#reading-root-files-from-other-servers

Either you configure your server or you need to install JSROOT on your server and use it from there. Typically second solution is much easier.

Regards,
Sergey

@alexandertuna
Copy link
Author

Hi Sergey,

What if I have jsroot installed on this server:
https://atlas-bb5.cern.ch/jsroot/index.htm

And yet it still cannot open the file?
https://atlas-bb5.cern.ch/jsroot/index.htm?file=https://atlas-bb5.cern.ch/bb5_web/files/run_1565946687003.hist.root

@alexandertuna
Copy link
Author

Hi again Sergey,

I see that this link works correctly on Safari and Firefox, but not on Google Chrome. So I cannot blame you for me having Chrome as my default browser.

In case you have any further suggestions, please let me know. Otherwise we will simply use firefox and move on.

Alex

@linev
Copy link
Member

linev commented Sep 5, 2019

First of all, my browsers reporting problem with invalid SSL certificate.
Probably this has side effects.

But I can confirm that Chrome does not work when Firefox does.
Seems to be, there is tiny difference between HTTP requests issued by these browsers.
As a result, server sends wrong response to Chrome - ignoring range supplied in HTTP request.

As a workaround you can use "+" sign after file name:

https://atlas-bb5.cern.ch/jsroot/index.htm?file=../bb5_web/files/run_1565946687003.hist.root+

But it means that complete file content will be loaded into the browser (for that particular case it is 55 MB).

And I will try to find better solution.

linev added a commit that referenced this issue Sep 5, 2019
@linev
Copy link
Member

linev commented Sep 5, 2019

Hi Alex,

It is interplay between wrong SSL certificate, Chrome and your HTTP server.
As a result, at some situation HTTP server returns wrong "Content-Length" value in HTTP response header. And JSROOT uses such header to prevent loading of huge data into the browser - there are other error situations when server ignore ranges and try to send complete file content.

For your problem I provide a workaround, which can be activated with wrong_http_response URL parameter.

http://jsroot.gsi.de/dev/?wrong_http_response&file=https://atlas-bb5.cern.ch/bb5_web/files/run_1565946687003.hist.root

You can download it from: http://jsroot.gsi.de/dev/JsRootDev.tar.gz

You can just edit in code to enable workaround by default (line 105 in JSRootCore.js):

JSROOT.wrong_http_response_handling = true;

Or add this code after loading of JSRootCore.js script.

Regards,
Sergey

@alexandertuna
Copy link
Author

Thanks very much Sergey.

@linev
Copy link
Member

linev commented Sep 5, 2019

I closing issue.

@linev linev closed this as completed Sep 5, 2019
@linev
Copy link
Member

linev commented Jan 6, 2021

In JSROOT v 6.0.0 flag will be renamed to:

JSROOT.settings.HandleWrongHttpResponse = true;

@linev
Copy link
Member

linev commented Nov 5, 2024

In JSROOT v 7.x it is:

import { settings } from 'jsroot';
settings.HandleWrongHttpResponse = true;

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

2 participants