DERP requires connection upgrade

Hi,

My company tasked me with finding a solution for setting up a remote development environment, so here I am.
As our own proof of concept, we have an AWS EC2 instance running and on it we have a "coder" container.
Coder service and workspaces run fine and dandy if we use the public IP of the instance as CODER_ACCESS_URL value.

Replacing the CODER_ACCESS_URL with our domain (ie coder.company.com), is where we hit the wall.

Coder dashboard works, I can create templates and from them workspaces, however, connection to a workspace does not work.

Looking at the code server logs, this is the message that is shown:

 {
"host": "coder.company.com", 
"path": "/derp", 
"proto": "HTTP/1.1", 
"remote_addr": "172.20.0.4:54062", 
"took": "69.837µs", 
"status_code": 426, 
"latency_ms": 0, 
"response_body": "DERP requires connection upgrade\n", 
"request_id": "143c2491-55dc-4e83-8d69-69016bf073cb"}


We're using Apache 2.4 as reverse proxy, with the following configuration for our virtual host:

MDomain coder.company.com
<VirtualHost *:443>

        Define SITE coder
        ServerName ${SITE}.company.com
        Protocols h2 http/1.1
        Define BACKEND http://coder:7080/
        SSLEngine on

        ProxyRequests           Off
        ProxyPreserveHost       On
        ProxyPass / ${BACKEND}
        ProxyPassReverse / ${BACKEND}
        
        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} =websocket [NC]
        RewriteRule /(.*) ws://coder:7080/$1 [P,L]
        RewriteCond %{HTTP:Upgrade} !=websocket [NC]
        RewriteRule /(.*) http://coder:7080/$1 [P,L]

</VirtualHost>


Not matter what I change, the connection to a workspace is immediately terminated or it hangs until it closes.
With the settings above, it'll hang (not sure how long), and then it'll disconnect.

I must admit, I'm really not all that familiar with Apache configuration, so I apologize if a fix is obvious.

Any ideas?
Was this page helpful?