Eclipse Theia, websockets and a reverse proxy

Hello Eclipse Theia community!

I recently created a set-up in which I run a docker container with OpenVSCode in a virtual machine and use a reverse proxy on the host to forward all traffic to the virtual machine. The container with OpenVSCode on the virtual machine runs fine, but when I try to access it, I get the message that the websockets have been closed prematurely.

After a discussion with some developers of OpenVSCode and with some experts on the Apache mailing list, the conclusion so far is that the Apache directives to rewrite the websocket traffic don’t work correctly and the only solution is to upgrade Apache to version 2.4.48 or later. I can’t do that however, because Red Hat Enterprise Linux (the distribution I’m using) only supports version 2.4.37.

Now my question:
*If I would install Eclipse Theia in my virtual machine, will I run into the same problem?
I suspect Eclipse Theia also uses websockets in the background?

The Apache rewrite directives that don’t seem to work:

RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) ws://$1 [P,L]

Below you can find a diagram of my set-up.

Hi @Scott-Trakker,

While Theia also uses websockets to connect to the backend, it also supports an HTTP-Fallback mode, which should be able to work with your use case. It currently has a few flaws, and suffers from performance problems when dealing with a lot of concurrent requests, but I aim to fix all of these problems in this PR.

Hi @msujew,

Ah, okay, that sounds very good!
This should be enabled during the build of an application? How?

The end result of the build process is a Node.js application which I could run on port 3000?

I’m in doubt about what to do: wait for an answer on my bug report on Red Hat’s Bugzilla or start creating a Theia application. I’m afraid that I will run in all kinds of new issues during the build.

@Scott-Trakker The HTTP-fallback is enabled by default. It can be disabled during the build by setting a flag in your dependency injection module, but you don’t need to do that.

In general I would recommend you to go with OpenVSCode if you just want a normal dev-setup (no branding, custom extensions, etc.). Although there shouldn’t be any build issues with Theia if you just use a simple setup without any custom extensions, VSCode is just offers a bit more compatibility for extensions and a more polished user experience. For a simple setup you can run the yeoman Theia generator with the empty option.


Thanks for the information!

I’m going to wait a few week until I get an answer on Red Hat’s Bugzilla. If the rewrite problem is solvable I will use OpenVScode, and if it’s not solvable I will build and install Eclipse Theia.

Hopefully, sometime in the future it will be possible to run Eclipse Theia in a container (with working extensions)!