Skip to content

Websocket is not respecting server path #247

@christophehenry

Description

@christophehenry

When installing joal from the provided JAR, behind a simple reverse-proxy, websocket is not respecting the path configured in joal.ui.path.prefix. In the browser console, an error indicates that the Js tries to connect to wss://<host>:80/ where no-one responds because the reverse proxy is configure to respond under <host>/joal. From what I can find in the code, this is expected since pathPrefix is configured to '':

export const getConfig = (): GuiConfig => {
  if (!cachedConf) {
    const localStorageConf = localStorage.getItem('guiConfig');
    if (!localStorageConf) {
      cachedConf = {
        host: window.location.hostname, // this default settings is to prevent Firefox to crash with "SecurityError: The operation is insecure." due to cross origin websocket
        port: window.location.port || '80', // this default settings is to prevent Firefox to crash with "SecurityError: The operation is insecure." due to cross origin websocket
        pathPrefix: '',
        secretToken: ''
      };
    } else {
      cachedConf = JSON.parse(localStorageConf);
    }
  }
  return cachedConf;
};

Also the port is not correctly set:

window.location.port || '80',

According to documentation window.location.port is set to '' if standard port are used so it should be 443 in case of HTTPS.

I'm sorry, I couldn't find the uncomressed JS code to fix that so I guess, in the meantime, the best solution is to host JAOL under a subdomain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions