Hello,
I am using jsroot in combination with THttpServer
to (hopefully) provide a geometry visualization service for a GitHub repository, but I am running into some very annoying issues with THttpServer cors which I am unable to fix with the available documentation (I am sure the answer is there, but its very hard to find).
I have a private (restricted to our organization) GitHub repository which hosts, among other things, some .root
files which contain a TGeoManager
object called Geometry
. I can access the latest version of a geometry via a link such as https://github.com/organization/repository/files/experiment/Geometry.gdml.root?raw=true
, which works only if your browser “knows” you have login into GitHub and have permissions. If this is the limiting factor I could host the files in some other open file server in sync with the repo. The THttpServer
would have problems downloading this file.
I would like to place some links inside the README of this repo that route you to an interactive visualization of the latest geometry, as is done in the JSROOT demos, such as Read a ROOT file.
I have tried the following solutions without success:
1 - Serving the files with python simple httpserver - CORS problem (I guess http://server:8080
!= http://server:8888
)
http://server:8080/?nobrowser&file=http://server:8888/files/experiment/Geometry.gdml.root?raw=true&item=Geometry
2 - Serving files directly from GitHub - same CORS problem
http://server:8080/?nobrowser&file=https://github.com/organization/repository/files/experiment/Geometry.gdml.root?raw=true&item=Geometry
I guess a solution would be to use THttpServer
as a file server, registering a directoy, but I am not sure how this would be done. I would like to know how this is done in the jsroot geometry examples.
I also tried to register all geometry objects to the server, but this is not a solution since you can only have a TGeoManager
instance at a time.
Also it would be really nice if we could use some already available server such as https://root.cern.ch/js/latest
to browser an arbitrary ROOT file by giving a link to the file (currently not possible due to cors), maybe this is a security risk, so perhaps restrict the files to friendly domains such as cernbox?.
Thanks!