fix: 3.0 Client cannot connect to server on subdirectory - #1776
Conversation
tassoevan
left a comment
There was a problem hiding this comment.
Unfortunately, we need to get that resolved URL for instances reached by a URL that replies a HTTP 3xx response. I guess it should be fix at the fetchServerInformation() function itself.
|
Thank you for pointing out. I have confirmed that the additional commit by tassoevan works on my server. |
| return [new URL('/', convertToURL(response.url)), responseBody.version]; | ||
| const finalEndpoint = convertToURL(response.url); | ||
|
|
||
| return [new URL('../..', finalEndpoint), responseBody.version]; |
There was a problem hiding this comment.
@tassoevan
Excuse me for pointing out late, maybe there are too many .. ?
There was a problem hiding this comment.
Well, the URL for reference is <server-root>/api/info.
There was a problem hiding this comment.
I tested another server url such https://foo.bar/apps/chat/, then the result is https://foo.bar/apps which losts /chat.
So, I tried a one liner test:
console.log((new URL('../..', 'https://foo.bar/apps/chat' + '/api/info')).href); // -> 'https://foo.bar/apps/'
console.log((new URL('..', 'https://foo.bar/apps/chat' + '/api/info')).href); // -> 'https://foo.bar/apps/chat/'Thanks.
There was a problem hiding this comment.
Can confirm:
Windows Rocket.Chat.Electron 3.0.3, rocketchat URL: http://foo.bar/rocketchat. Does not work. DevTool shows that it makes successfull query to http://foo.bar/rocketchat/api/info (HTTP 200, {version: "3.1.1", success: true}).
console.log((new URL('../..', 'http://foo.bar/rocketchat/api/info')).href); // -> 'https://foo.bar/'
new URL semantic is relative to the last full url path segment (last separator "/"). As example:
console.log((new URL('../..', 'http://foo.bar/rocketchat/api/info/')).href); // -> http://foo.bar/rocketchat/
There was a problem hiding this comment.
Oh man, you guys are right. I forgot that previously I was traversing a URL with the trailing slash. Please wait, I'll try to add some tests to assert this kind of stuff.
|
@tassoevan I'm confused here. Is this supposed to be fixed in 3.0.3? Because we have the issue with 3.0.3 still. |
|
The same issue is still open. #1796 |
Closes #1775