Skip to content

Loading index.js cause ERR_CONTENT_LENGTH_MISMATCH #2792

Closed

Description

@spinachomes

Client or integration

OpenCodex dashboard

Area

Dashboard

Summary

When opening the web page, loading index.js failed with an ERR_CONTENT_LENGTH_MISMATCH error, causing the page to display blank.
It works properly only when using Nginx as a reverse proxy.

Reproduction

ocx start on centos7.6

Version

2.33.0

Operating system

Node.js 22 unofficial build for glibc 2.17 on CentOS 7.6

Provider and model

No response

Logs or error output

Screenshots and supporting files

No response

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    guiDashboard, tray, settings UI
    proxyHTTP proxy, routing, reverse-proxy / management auth
    on Aug 28, 2026
  2. spinachomes commented on Aug 28, 2026

    @spinachomes
    Author

    Moreover, the OCX service installation is not supported. It seems to have a syntax error, likely because the --user option is not supported.

  3. spinachomes commented on Aug 28, 2026

    @spinachomes
    Author

    Additionally, I am deploying OpenCodex with Docker on CentOS 7.6, using a Node.js 18 image, and I still get this error without Nginx.

  4. lidge-jun commented on Aug 28, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 62 / 80

    이 이슈는 대시보드를 열 때 index.js가 ERR_CONTENT_LENGTH_MISMATCH로 실패해서 흰 화면이 된다는 보고입니다. Nginx 리버스 프록시를 앞에 두면 됩니다. 작성자는 spinachomes입니다. 환경은 CentOS 7.6, glibc 2.17용 비공식 Node 22, OpenCodex 2.33.0입니다. 같은 사람이 Docker Node 18 이미지로도 Nginx 없이는 재현된다고 댓글을 달았습니다. 그래서 Node 버전만의 문제는 아닙니다. 지금 dev HEAD는 50e955604이고 package.json은 2.35.0입니다. 보고 버전과 HEAD 글자는 다릅니다. 구현 풀은 없습니다.

    정적 파일은 src/server/gui-static.ts serveGuiFile이 담당합니다. html은 readFileSync로 읽어 길이 없는 문자열 응답을 만듭니다. js/css는 new Response(Bun.file(filePath))입니다. Bun.file은 보통 디스크 크기만큼 Content-Length를 붙인 뒤 스트림으로 보냅니다. 중간에 압축하거나, 연결이 끊기거나, 오래된 HTTP 스택이 길이를 다시 쓰면 브라우저가 이 오류를 냅니다. Nginx가 고치는 이유는 파일을 다시 버퍼링해서 길이를 다시 쓰기 때문입니다. 모바일/데스크톱 차이는 이 이슈 본문에는 없고, 짝인 #2791에 있습니다.

    댓글의 ocx 서비스 설치 --user 미지원은 다른 구멍입니다. #2713이 리눅스에서 심 없이 토큰을 넣는 길을 다루고, 그 리뷰에서 systemd --user를 루트 서버 기본으로 두지 말라고 이미 적었습니다. 이 이슈에 설치 문제를 섞지 마세요. types.ts/config.ts 분할과 무관하고, preview deploy도 필요 없습니다. #2791과 같은 호스트, 같은 작성자이지만 증상은 다릅니다. 이쪽은 번들 파일 길이, 저쪽은 로그 API 30초 타임아웃입니다. 중복으로 닫지 마세요.

    경로/심볼 src/server/gui-static.ts serveGuiFile - js는 Bun.file 스트림입니다. Content-Length를 다시 계산하지 않습니다.
    경로/심볼 src/server/gui-static.ts htmlResponse - html은 문자열이라 이 오류의 주 용의자가 아닙니다. 본문이 가리키는 파일은 index.js입니다.
    이슈 본문 - 재현에 브라우저 URL, 직접 포트인지 Nginx인지, index.js 실제 바이트와 응답 헤더가 없습니다.
    댓글 systemd --user - GUI 흰 화면과 다른 문제입니다. #2713으로 보내세요.
    이슈 #2791 - 같은 작성자의 로그 타임아웃입니다. 링크로만 묶고 닫지 마세요.

    메인테이너의 판단이 필요한 지점

    • Bun.file 길이 불일치를 코드 버그로 볼지, CentOS 7.6/구식 HTTP 경로의 환경 문제로 볼지
    • 고친다면 js를 메모리에 읽어 Content-Length를 다시 쓸지, 길이를 빼고 chunked로 보낼지
    • 지원선에서 CentOS 7.6 glibc 2.17을 받을지. 공식 런타임은 Bun입니다
    • 설치 --user 댓글을 이 이슈에 남길지, #2713으로 옮길지

    너의 추천
    이 이슈는 엽니다. 닫지 말 것. 작성자에게 직접 접속 URL, index.js 응답의 Content-Length와 실제 바이트, Nginx 유무를 부탁하세요. 코드 쪽 후보는 serveGuiFile의 Bun.file 길이입니다. 설치 --user는 #2713으로 분리하세요. #2791과 중복 처리하지 마세요. 라벨은 그대로 둡니다. 내가 머지하지 않습니다.

    이 댓글은 grok-bot이 작성했습니다

  5. lidge-jun commented on Aug 28, 2026

    @lidge-jun
    Owner

    Fixed on dev by commit e546c16 (PR #2859).

    There was a real race behind this. Static assets were served via Bun.file, and the declared Content-Length could outlive the backing file — if the file changed or went away between the length being computed and the body being written, the browser received fewer bytes than promised and Chrome reported ERR_CONTENT_LENGTH_MISMATCH. Static assets are now snapshotted before the response is framed, so the declared length and the written bytes come from the same immutable read.

    Verified against a live isolated proxy: the RED case reproduced a truncated body, and after the fix the declared and received counts agree exactly at 2,482,833 bytes — both with and without gzip negotiation.

    This PR targeted dev, so GitHub did not auto-close the issue — closing manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingguiDashboard, tray, settings UIproxyHTTP proxy, routing, reverse-proxy / management auth

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions