nzilbb / labbcat-server

Server components for LaBB-CAT
GNU Affero General Public License v3.0
2 stars 0 forks source link

Any working nginx reverse proxy config file to share? #37

Closed fishfree closed 2 months ago

fishfree commented 2 months ago

I'd like to set up HTTPS nginx reverse proxy for LabbCat server and its built-in EMU webapp. Could some guys share a working one, please?

robertfromont commented 2 months ago

One gotcha for HTTPS with a reverse proxy is that LaBB-CAT needs to know the URL used to access it, for various reasons.

By default it uses the incoming request to infer the correct URL. In reverse-proxy situations, this can be problematic because the local connection looks like HTTP, not HTTPS, so it gets the URL wrong.

The solution to this is explicitly specify the base URL that browser clients will be using with the baseUrl parameter in LaBB-CAT's web.xml file.

By default, this is installed as:

  <context-param>
    <param-name>baseUrl</param-name>
    <param-value/>
  </context-param>

To get LaBB-CAT working properly behind a reverse proxy that provides HTTPS, you need to change this to something like:

  <context-param>
    <param-name>baseUrl</param-name>
    <param-value>https://example.com/labbcat</param-value>
  </context-param>

(note that the baseUrl has no trailing slash)

fishfree commented 2 months ago

Thanks~