Wrap an apache application?

LabKey Support Forum (Inactive)
Wrap an apache application? Anthony Corbett  2014-07-14 13:13
Status: Closed
 
I've never set this up myself, but here are some ideas:

From the JBrowse Configuration Guide, it looks like the default index.html page that comes with JBrowse can be embedded in an iframe: http://gmod.org/wiki/JBrowse_Configuration_Guide#Embedded_mode

<div style="width: 400px; margin: 0 auto;">
  <iframe style="border: 1px solid black" src="../../index.html?data=sample_data/json/volvox&tracklist=0&nav=0&overview=0&tracks=DNA%2CExampleFeatures%2CNameTest%2CMotifs%2CAlignments%2CGenes%2CReadingFrame%2CCDS%2CTranscript%2CClones%2CEST" width="300" height="300">
  </iframe>
</div>


This would give you control of JBrowse through the query string parameters of the iframe's source URL; see http://gmod.org/wiki/JBrowse_Configuration_Guide#Controlling_JBrowse_with_the_URL_Query_String

Thus, you could create a file based module with a html view with this iframe embedded in it and all the code/queries you need to create the correct query parameters. It maybe possible to also use file-based tasks and sequences to run the perl scripts for formatting feature data and to generate pre-rendered image tracks.


The other thing is how you "push out" to JBrowse, or in other words, where is JBrowse being hosted? Here are 2 options:

One way is to have JBrowse on a completely different host from the host serving the Labkey web application (though you may or may not need to worry about cross-orgin configuration http://gmod.org/wiki/JBrowse_Configuration_Guide#Cross-origin_resource_sharing_.28CORS.29:_showing_data_on_multiple_servers)

Or, as in my group's case, if you already have Apache in front of Tomcat you might be able to use mod_rewrite/mod_alias to provide rules to serve JBrowse from the same virtual host under a different URL path than labkey; e.g. reverse proxy labkey runing at myinstance.org/labkey and then configure the virtual host to serve JBrowse at myinstance.org/jbrowse. see http://httpd.apache.org/docs/2.2/urlmapping.html By reusing the same virtual host allows you to set the iframe's src URL to src="/jbrowse/index.html?data..." and the browser will automatically insert the current domain/host.

As for authentication, JBrowse can use cookie authentication (see http://gmod.org/wiki/JBrowse_Configuration_Guide#Authentication_and_Access_Control). It might be possible to have a page in labkey set a session cookie before rendering the JBrowse in the iframe. Again, I'm not sure if modern browsers allow this type of interaction and it probably isn't the safest way to do authentication in general.

-
Anthony Corbett