st2web icon indicating copy to clipboard operation
st2web copied to clipboard

Proposal: Change axios external requests to use relative path

Open jdmeyer3 opened this issue 5 years ago • 0 comments

When deploying stackstorm behind a reverse proxy, the web interface is unable to properly build the api, auth, and stream path. For example, if I have a nginx path of /stackstorm(.*) and I rewrite the url to /$1 the ui will properly route all of its assets (/stackstorm/index.html, /stackstorm/js/main.js, etc.), but when the stackstorm web sends requests to the apis, it builds the path as /auth/tokens rather than /stackstorm/auth/tokens.

This is primarily because the api path in the st2-api module is using absolute path when it builds the api paths (ex. 'https:'}//${window.location.host}/api). The proposal is to change the server paths from absolute path to relative pathing in order to allow stackstorm to work behind reverse proxies.

On proposal for using relative path would be to change the modules/st2-api.js:81 code to

      this.server = {
        api: 'api',
        auth: 'auth',
        stream: 'stream',
        token: !_.isEmpty(token) ? token : null,
      };

jdmeyer3 avatar Jan 29 '20 20:01 jdmeyer3