elasticsearch-HQ icon indicating copy to clipboard operation
elasticsearch-HQ copied to clipboard

Fixes #527: Allow suburl to map the application

Open Yunha-Lee opened this issue 3 years ago • 0 comments

Instructions

Please try and perform pull requests against the develop branch.

Merging against the master branch causes a new release to be deployed, and I'd like to avoid that on every PR.

PR Details

Fixed an issue where the base url was ignored when calling the websocket api of the metrics page when accessing through a reverse proxy

Description

As already pointed out in issue #527, when accessing through a reverse proxy, when a url with a base path is used, the base path is ignored and the metrics page is not properly loaded. (e.g. https://www.example.com/elastichq)

The reason is that the subpath of the url entered when establishing a connection to the socket.io is recognized as a namespace. In order to use the subpath of the reverse proxy as it is, a custom path must be set separately. For example, if you enter url as the following, the socket will connect to the elastichq namespace.

this.socket = io("https://www.example.com/elastichq");

To include elastichq in the custom path as intended, it should be modified as follows.

this.socket = io("https://www.example.com", { path: "elastichq/socket.io" });

So, I separated the url part and the baseurl part, and modified it to establish the connection in the correct way. I tested through the nginx proxy environment of kubernetes, and it worked fine in my case. There seems to be a lot of similar questions, so I send a pull request with the modified version. If there is anything wrong, please comment. I hope it helps.

Related Issue

https://github.com/ElasticHQ/elasticsearch-HQ/issues/527

Yunha-Lee avatar Sep 24 '20 14:09 Yunha-Lee