Howto change the application context path (/openboxes)

hey community, i Want to change appName from openboxes to another name, because I want to change the routing, for example I want to have (http://localhost:8080/**CustomName** or http://localhost:8080/ ) instead of http://localhost:8080/openboxes.
is there any place in config file to have this feature, when i change only name of folder I get errors in routing.

Thank You.

Hey @pahem28316

I think this post has been stuck in our approval queue for a while. Apologies.

Unfortunately, the application cannot handle a change to the appName (context path) at this point (i.e. in the 0.8.x line). However, the next major release (0.9.x) will support this requirement.

The problem stems from the fact that all of the React features use a hard-coded context path (/openboxes) for accessing our REST API. We needed to make a pretty major change to get it to work properly, so we decided that it would be safest to make the change to a major release (0.9.x).

We don’t have a definitive timeline for the 0.9.0 release, but we hope to have it ready by the end of the summer.

Attaching the jira ticket (pdf) in case you’re interested in the details, including how to configure it when we finally release the version with it working.

OBGM-141.pdf (454.7 KB)

And here’s the pull request that shows how the problem was solved.

Lastly, in case you want to test the feature (although not sure if it’s still working) we have experimental builds of the application running on the Grails 3 framework here.

https://bamboo-ci.pih-emr.org/browse/OPENBOXES-OBDEV3

You can download the WAR (which can be run on Tomcat8+, Java 8) by clicking on one of the build numbers, looking under the Artifacts tab, and clicking on the Latest WAR link.

Or by using the following link.

https://bamboo-ci.pih-emr.org/browse/OPENBOXES-OBDEV3/latest/artifact/shared/Latest-WAR/openboxes.war

I have deployed 0.9.3 on my local machine still I am unable to find a way to change the context path.

Great question. I am not entirely sure this works 100% yet but have been meaning to test it out in order to document the process in our Configuration Guide.

Give me (or Artur) a few days to unravel the mystery. If you don’t hear back from one of us by the end of the week, bump this thread.

Justin

I set the context path in ~/.grails/openboxes.yml as

server.contextPath = "/brokenboxes"

and it seems to be working.

If I go directly to the Login page, then I can authenticate.

https://<server>:<port>/brokenboxes/auth/login

however after authentication, I’m getting weird behavior at the moment (it’s redirecting me to the default context path). I cannot tell if that’s related to my ngrok config or the application, so I’ll need to rip out the ngrok config and try again.

https://<server>:<port>/openboxes

But again, if I go directly to a known URL, I see the appropriate page.

https://<server>:<port>/brokenboxes

I’ll share a video when I get a chance to unravel the /openboxes redirect.

It wasn’t the ngrok config, just the grails.serverURL config getting in the way and causing the redirect to a URL with the wrong cotnext path (i.e. /openboxes).

With the following configuration, I was able to get the context path working in my development environment (embedded Tomcat).

server.contextPath: "/brokenboxes"
grails.serverURL: "https://openboxes.ngrok.io/brokenboxes"

I’m under the impression that it should work the same with a standalone Tomcat instance or a standalone WAR file running on a remote server. However, I still need to test that out.

Next steps

Attempt to configure the context path (/brokenboxes) on one of our test servers
Attempt to configure a root context path (/) on one of our test servers
Document the context path setting in our Configuration Guide

Ok, last message for the evening.

I wanted to see if I could get the application deployed to the root (/) context path on a standalone instance of Tomcat on one of our test servers. And it worked!

Here’s the general approach

  1. Configure the context path and serverURL in openboxes.yml
    grails:
      serverURL: https://ocho.openboxes.com
    
    server:
      contextPath: "/"
    
  2. Deployed the application as ROOT.war to Tomcat using the following commands
    sudo service tomcat stop
    mv /var/lib/tomcat9/webapps/openboxes.war /var/lib/tomcat9/webapps/ROOT.war
    sudo service tomcat start
    

… et voilà!

Yay! No more ugly context path. I cannot guarantee that this is going to work :100: across the entire application, so consider this a beta feature and provide feedback if you see any issues.

Note: If you’re using Apache or Nginx to handle SSL termination (and/or to forward requests to Tomcat), then you need to address your proxy settings as well.

For me (using Apache 2) that meant changing the proxy config from this

ProxyPass /openboxes http://127.0.0.1:8080/openboxes
ProxyPassReverse /openboxes http://127.0.0.1:8080/openboxes

to

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

and commenting out the default redirect config for the root context.

# Redirect requests for root context
#RedirectMatch ^/$ /openboxes/

All sorted thank you