Double URL prefixing for web app

We have put together an OnDemand app for LaBB-CAT, a browser-based linguistics research tool. LABB-CAT sets up links at the top of the screen; we had to set

LABBCAT_BASE_URL="/rnode/$(hostname)/$port"

to add the right prefix to make those links point to the right location. With this in place, everything mostly works except that there are a few forms where the software generates redirects. These wind up failing, essentially because they get double-prefixed; i.e., instead of being prefixed with /rnode/$(hostname)/$port they get prefixed with /rnode/$(hostname)/$port/rnode/$(hostname)/$port. The developer and I did some debugging and it looks like LaBB-CAT is requesting the right URL; it’s just that this request gets prefixed by OOD before it goes to the browser.

I read in the documentation about the difference between rnode and node so I tried changing rnode to node, i.e.,

LABBCAT_BASE_URL="/node/dt045/24856"

but that breaks basically everything else - the stylesheets don’t load, the pages throw various errors - so that I don’t get a chance to try out the functionality that was broken when rnode was used.

Any thoughts about how we can get both functionalities (the vanilla links at the top of the page as well as redirects) to work?

Our app: https://github.com/AdvancedResearchComputing/ARC-ondemand-apps/tree/master/bc_vt_labbcat_singularity_docker_tinkercliffs
LaBB-CAT main page: http://labbcat.sourceforge.net/
LaBB-CAT DockerHub: Docker Hub

Hi and welcome!

Is it a relative URL like ../foo/bar? I know RStudio documentation does something similar and we have this issue for the same.

Thanks! No, I believe that they’re full URLs. This is from the developer after looking at logs:

Essentially, LaBB-CAT is sending a 302 (redirect) response something like:

HTTP/1.1 302
Location: https://ondemand-preprod.it.vt.edu/rnode/dt046/15610/layermanagers/HTK/install.help

But the browser is receiving something like:

HTTP/1.1 302
Location: https://ondemand-preprod.it.vt.edu/rnode/dt046/15610/rnode/dt046/15610/layermanagers/HTK/install.help

…which means something between the LaBB-CAT and the browser is changing the Location header.

Most likely some Open OnDemand assumes that LaBB-CAT would return redirects based on the apparent request URL - the base.jsp script told us that LaBB-CAT it told its request URL’s look like http://dt046:36985/base.jsp even though that’s not the URL entered into the browser - so it’s trying to fix the Location header by adding rnode/dt046/15610/ to it.

But LaBB-CAT doesn’t need that correction, because you already told it (by way of LABBCAT_BASE_URL) what the real URLs are.

I see. So I think you do in fact need /node type locations if you set LABBCAT_BASE_URL. Basically the 2 options are mutually exclusive. You either want to use /node & set LABBCAT_BASE_URL OR just use /rnode.

Thanks Jeff. I’ve tested all of the options that I can think of and can’t find one that does what we need:

I started with the top line of view.html.erb set to:

<form action="/rnode/<%= host %>/<%= port %>/auth-do-sign-in" method="post" target="_blank">

and observed the following:

  1. LABBCAT_BASE_URL="/rnode/$(hostname)/$port": Previously described behavior. HTML menu links and most functionality works, but redirects are broken due to double-prefixing (content shows as The "url" attribute illegally evaluated to "null" or "" in <import>).
  2. LABBCAT_BASE_URL="/node/$(hostname)/$port": Stylesheets don’t load, the content on all pages doesn’t load (content shows as The "url" attribute illegally evaluated to "null" or "" in <import>).
  3. rnode with full path (e.g., LABBCAT_BASE_URL=https://ondemand-preprod.it.vt.edu/rnode/dt034/50481): Same as (1)
  4. node with full path (e.g., LABBCAT_BASE_URL=https://ondemand-preprod.it.vt.edu/node/dt034/21196): Same as (2)
  5. Leave LABBCAT_BASE_URL unset: Stylesheets and HTML links don’t work at all (e.g., point to http://dt034:20601/admin/layers/phrase)

After reading your message, I then set the top line of view.html.erb to:

<form action="/node/<%= host %>/<%= port %>/auth-do-sign-in" method="post" target="_blank">

and observed the same behavior on (2) and (4) (LABBCAT_BASE_URL="/node/$(hostname)/$port"), i.e., stylesheets don’t load, the content on all pages doesn’t load (content shows as The "url" attribute illegally evaluated to "null" or "" in <import>).

It’s possible that I’m missing something and there’s another option here that I’m not thinking of so please let me know if there’s something else that I should try.

So just to summarize:

  1. I need to provide LABBCAT_BASE_URL to get basic things - stylesheets, link URLs - to work
  2. With LABBCAT_BASE_URL in place, LaBB-CAT would, I think, work fine if not for OnDemand changing the paths of redirects.

So is there a way to effectively turn off OnDemand’s handling of redirects for this app? (I think there are global ways to do this but I’m hesitant to touch any settings for our full OOD implementation just for this app.)

Hey, yea it seems like LABBCAT_BASE_URL is required with /node type URLs. Are you able to share the app? We don’t have it at OSC, but I could try to take a look at it.

Unfortuantly there’s no way to disable the redirects/URL re-writes and still have any of this batch connect plugin functionality.

Sure, hopefully this is what you need:

And if not I’d be happy to, for example, do a Zoom where I show you what I’m seeing.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.