Merge pull request #14694 from sveinugu/dev

Allow path-based interactive tools using nginx proxy
This commit is contained in:
Marius van den Beek
2022-10-17 11:24:38 +02:00
committed by GitHub
2 changed files with 31 additions and 6 deletions
@@ -77,7 +77,8 @@ Set these values in `galaxy.yml`:
# ...
If you do want to use nginx as an upstream proxy server you can use the following server section to route requests to the InteractiveTool proxy:
If you do want to use nginx as an upstream proxy server you can use the following server section to route requests to
the InteractiveTool proxy:
.. code-block:: nginx
@@ -87,7 +88,7 @@ If you do want to use nginx as an upstream proxy server you can use the followin
# Match all requests for the interactive tools subdomain
server_name *.interactivetool.localhost;
# Proxy all requests to the GIE Proxy application
# Route all domain-based interactive tool requests to the InteractiveTool proxy application
location / {
proxy_redirect off;
proxy_http_version 1.1;
@@ -101,8 +102,33 @@ If you do want to use nginx as an upstream proxy server you can use the followin
Note that this nginx example uses https, so you need to have a wildcard certificate for your domain,
and you need to adjust ``galaxy_infrastructure_url`` as appropriate. You will most likely also want
to replace localhost with your server domain.
and you need to adjust ``galaxy_infrastructure_url`` as appropriate.
It is also possible to set up nginx to route path-based interactive tool URLs to the InteractiveTool proxy.
Path-based interactive tool URLs will only be created for tools that have defined ``requires_domain=False`` in the tool
XML file (which signals that the web server running on the container does not require a domain name to serve pages
correctly). To support path-based interactive tools through nginx proxy, add the following to the main Galaxy "server"
section (serving port 443):
.. code-block:: nginx
# Route all path-based interactive tool requests to the InteractiveTool proxy application
location ~* ^/(interactivetool)/access/(.+)/([0-9a-f]+)/([0-9a-f]+)/(.*)$ {
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $3-$4.$1.$host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:4002/$5$is_args$args;
}
This example config works for default values of `interactivetools_base_path` and `interactivetools_prefix` as defined in
`galaxy.yml`. For other values, you will need to adjust the regex and rename patterns accordingly. This solution also
requires `interactivetools_shorten_url` to be set to `false` (not default).
In both nginx config examples, you will most likely also want to replace localhost with your server domain (or possibly
``127.0.0.1``).
You will also need to enable a docker destination in the job_conf.xml file.
An example ``job_conf.xml`` file as seen in ``config/job_conf.xml.interactivetools``:
+1 -2
View File
@@ -319,8 +319,7 @@ class InteractiveToolManager:
rval = f"/{rval}/{entry_point_prefix}/access/{entry_point_class}/{entry_point_encoded_id}/{entry_point.token}/"
if entry_point.entry_url:
rval = f"{rval.rstrip('/')}/{entry_point.entry_url.lstrip('/')}"
if rval[0] != "/":
rval = f"/{rval}"
rval = "/" + rval.lstrip("/")
return rval
def access_entry_point_target(self, trans, entry_point_id):