Skip to content

[Bug] Getting connect ECONNREFUSED when app is running on localhost #7017

@15m43lk4155y

Description

@15m43lk4155y

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: Ubuntu
  • Docker image: codercom/code-server
  • code-server --version: 4.91.1

Steps to Reproduce

  1. docker container running locally with the image built using the following Dockerfile:
FROM codercom/code-server:4.91.1

CMD ["dumb-init", "code-server", "--proxy-domain", "{{port}}.customdomain.tld", "--port", "8443", "--auth", "none"]
  1. local DNS pointing customdomain.tld to 127.0.0.1
  2. NGINX reverse proxy that points to the code-server instance with two .conf files:
server {
    listen 80;
    server_name customdomain.tld;
    location / {
        proxy_pass http://container_ip:8443;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
}

and

server {
    listen 80;
    server_name ~^(\d+)\.customdomain\.tld$;
    location / {
        proxy_pass http://container_ip:8443;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
}
  1. run http server in the code server terminal using python -m http.server -b localhost then open 8000.customdomain.tld in the browser

Expected

It should show the http server correctly

Actual

the following error displays:
Screenshot from 2024-10-01 04-28-46
Note that when running python -m http.server -b 127.0.0.1 the server is shown correctly as per the following image:
Screenshot from 2024-10-01 04-31-04

Logs

No response

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

I did not test native VS Code

Does this bug reproduce in GitHub Codespaces?

I did not test GitHub Codespaces

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

This was tested using an angular app as well (since the host is localhost by default in it) and the same happens when I set the host in ng serve to 127.0.0.1 the app is shown correctly when I leave it by default (aka localhost) it doesn't

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageThis issue needs to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions