Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from /terminal to /terminalsocket assumes that /terminal was at the root of the URL #142

Closed
gjsjohnmurray opened this issue Apr 11, 2021 · 3 comments · Fixed by #147

Comments

@gjsjohnmurray
Copy link
Contributor

function getNewWs () {
return new WebSocket(`${ (location.protocol === "https:" ? "wss:" : "ws:")
}//${ location.hostname }:${ location.port ||
(location.protocol === "https:" ? "443" : "80")
}/terminalsocket/${ encodeURIComponent(CACHE_CLASS_NAME) }`);
}

This fails in a situation where a "real" web server is hosting Web Gateway connections to multiple InterSystems servers. For instance an IIS instance on a server named webhost configured with root applications dev and test, and the Web Gateway connecting /dev and /test URLs to different InterSystems servers.

The WebTerminal URL for the dev server would be http://webhost/dev/terminal/ but the code above points the websocket to ws://webhost/terminalsocket/WebTerminal.Engine.cls

@nikitaeverywhere
Copy link
Member

nikitaeverywhere commented Apr 12, 2021

Hello! Thanks for reporting this issue.

I'm not maintaining this project right now - however I would gladly accept any pull request you can make. If you could also export the XML from any prior-IRIS installation, I can then release it via official channels.

I am not very sure how environments work, but it seems to be easy to fix, as far as I understand:

 function getNewWs () { 
     return new WebSocket(`${ (location.protocol === "https:" ? "wss:" : "ws:") 
         }//${ location.hostname }:${ location.port || 
         (location.protocol === "https:" ? "443" : "80") 
-         }/terminalsocket/${ encodeURIComponent(CACHE_CLASS_NAME) }`); 
+         }${ location.pathname.includes('/terminal') ? location.pathname.replace(/\/terminal.*/, "/terminalsocket") : "/terminalsocket" }/${ encodeURIComponent(CACHE_CLASS_NAME) }`); 
 } 

@gjsjohnmurray
Copy link
Contributor Author

@ZitRos I have submitted PR #147 to resolve this.

@nikitaeverywhere
Copy link
Member

Thanks a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants