Skip to content

audiocpp_server : cors_origins It doesn't work. #720

Closed

Description

@juntaosun
{
  "host": "127.0.0.1",
  "port": 7788,
  "backend": "cuda",
  "cors_origins": "*",
  "device": 0,
  "threads": 1,
  "lazy_load": true,
  "max_loaded_models": 1,
  "idle_unload_ms": 60000,
  "models": [
    {
      "id": "qwen3-align",
      "family": "qwen3_forced_aligner",
      "path": "models/Qwen3-ForcedAligner-0.6B-GGUF",
      "task": "align",
      "mode": "offline"
    },
    {
      "id": "qwen3-asr",
      "family": "qwen3_asr",
      "path": "models/Qwen3-ASR-0.6B-GGUF",
      "task": "asr",
      "mode": "offline",
      "session_options": {
        "language": "Chinese"
      }
    }
  ]
}

I added "cors_origins": "*" to allow cross-origin JS access;
(1) Testing with "qwen3-asr" succeeded; JS calls to audiocpp_server worked normally.
(2) Calling "qwen3-align" failed, and the browser reported:
Access to fetch at 'http://127.0.0.1:7788/v1/audio/alignments' from origin 'http://localhost:8989' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested...

It is strange—using the same audiocpp_server configuration,
"cors_origins" works for some cases but not others. This looks like a bug, doesn't it?

Activity

  1. modelpath-dev commented on Sep 28, 2026

    @modelpath-dev

    It seems like the CORS issue is inconsistent between different tasks. I'd check if there's any difference in how the server handles CORS headers for "align" versus "asr" tasks.

  2. 0xShug0 commented on Sep 28, 2026

    @0xShug0
    Owner

    @juntaosun Thanks for reporting the bug! Yes, it’s a bug. The issue is the misleading error message. The error response lacks the CORS header, causing the browser to show a CORS error instead of the actual missing-language error. CORS handling is shared across all endpoints --- just one line header

    response.headers["Access-Control-Allow-Origin"] = allowed_origin;

    There is no special treatment for align versus asr.

    I will fix the issue.

  3. 0xShug0 commented on Sep 28, 2026

    @0xShug0
    Owner

    @juntaosun @modelpath-dev PR merged. Let me know if you can see the real errors now.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions