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

CORS error when displaying code-server in a localhost iframe #7273

Open
1 of 2 tasks
johnykes opened this issue Mar 20, 2025 · 1 comment
Open
1 of 2 tasks

CORS error when displaying code-server in a localhost iframe #7273

johnykes opened this issue Mar 20, 2025 · 1 comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@johnykes
Copy link

johnykes commented Mar 20, 2025

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Brave
  • Local OS: Windows 11
  • Remote OS: Ubuntu 24
  • Remote Architecture: amd
  • code-server --version: latest

Steps to Reproduce

  1. create a code-server using docker-compose on a ubuntu server
services:
  code-server:
    image: lscr.io/linuxserver/code-server:latest
    # image: linuxserver/code-server:latest
    container_name: code-server
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - PASSWORD=password #optional
      - HASHED_PASSWORD= #optional
      - SUDO_PASSWORD=password #optional
      - SUDO_PASSWORD_HASH= #optional
      - DEFAULT_WORKSPACE=/config/workspace #optional
    privileged: true
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ./data/template/config:/config
    ports:
      - 8443:8443
    restart: unless-stopped

  1. add HTTPS/SSL using CF tunnels / traefik or something
  2. create a simple web page with an iframe that has src="your code-server url"

if I deploy the webpage with the same iframe on Vercel or something, it login works, but doesn't work from localhost. Why? That's annoying

Expected

I expect to see the code-server content in the iframe, even if I'm on localhost.

Actual

Image

Logs

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

Yes, this is also broken in native VS Code

Does this bug reproduce in GitHub Codespaces?

Yes, this is also broken in GitHub Codespaces

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

Is there any setting for CORS on the code-server?

@johnykes johnykes added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Mar 20, 2025
@johnykes johnykes changed the title CORS error when using password auth and code-server in a localhost iframe CORS error when displaying code-server in a localhost iframe Mar 20, 2025
@benz0li
Copy link
Contributor

benz0li commented Mar 20, 2025

Please be aware that the image of this repository is codercom/code-server and not linuxserver/code-server.

Please open issues regarding linuxserver/code-server at https://github.com/linuxserver/docker-code-server/issues.

@benz0li benz0li mentioned this issue Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants