openlink / virtuoso-opensource

Virtuoso is a high-performance and scalable Multi-Model RDBMS, Data Integration Middleware, Linked Data Deployment, and HTTP Application Server Platform
https://vos.openlinksw.com
Other
856 stars 210 forks source link

How to change root path of the whole Virtuoso? #941

Open nguyenlamlll opened 3 years ago

nguyenlamlll commented 3 years ago

Hi everyone, I'm using this image to spin up a Virtuoso instance (openlink/virtuoso-opensource-7). It runs great and I can access Virtuoso at http://localhost:8890/.

However, my scenario is to host Virtuoso at a subpath (e.g.: my-website.com/virtuoso) using nginx (nginx ingress controller in Kubernetes). The images, css, js are referenced relatively. So, those media files will not be included properly.

Is there any way that we can change the root path of the whole Virtuoso instance?

Many thanks!

HughWilliams commented 3 years ago

As Virtuoso has its own internal HTTP server, applications like the Conductor and Faceted Browser were written to be protocol (http/https) and host:port agnostic, but not path agnostic, so they rely on constructions like Faceted Browser to work.

When using a reverse proxy, this is normally not an issue, since it just maps http://cname/path/page to http://backend1:port1/path/page or http://backend2:port2/path/page to allow for load balancing multiple identical backend servers.

However as you introduced an extra path component so --

http://my-website.com/virtuoso/path/page

-- needs to map to --

http://backend1:port1/path/page

You need to do some additional mapping in your proxy to make sure any url in the result page like --

/path/image/image1.jpg

-- is mapped back to --

/virtuoso/path/image/image1.jpg

-- so the browser can fetch it after loading the initial page.

Similarly, 30X redirects will need to be rewritten to use the external name.

Kubernetes has a number of settings to do this level of asymmetric page mapping which are detailed here:

https://kubernetes.github.io/ingress-nginx/examples/rewrite/

That should enable you to perform the necessary mappings.