[GH-ISSUE #3208] [Other] Strata 0.2.0-beta - XCORS settings unclear #1300

Closed
opened 2026-11-04 01:50:10 +07:00 by bsakaguchi · 9 comments
Owner

Originally created by @MaKla89 on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3208

Cheers!

In previous releases (and likely still working like that in the CLI-version) I was able to add "cors-origins" to the json config and have my selfmade (okay... vibe coded) web-apps access the strata-api.

With the new app, adding this line does not help it any longer. I guess this is due to the new app using a different client-facing api server (which also comes with a different default port. 8080 is still configured in the json-file, but the app shows port 47832 as the default. I have no clue how to enable XCORS for this new server, though.

I'm running this on a Ryzen 7 9800x3D with 128GB DDR5 RAM , a GeForce 4080 and a Geforce 3060 (12GB). I'm using Strata 0.2.0-beta under linux / cachyOS

Originally created by @MaKla89 on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3208 Cheers! In previous releases (and likely still working like that in the CLI-version) I was able to add "cors-origins" to the json config and have my selfmade (okay... vibe coded) web-apps access the strata-api. With the new app, adding this line does not help it any longer. I guess this is due to the new app using a different client-facing api server (which also comes with a different default port. 8080 is still configured in the json-file, but the app shows port 47832 as the default. I have no clue how to enable XCORS for this new server, though. I'm running this on a Ryzen 7 9800x3D with 128GB DDR5 RAM , a GeForce 4080 and a Geforce 3060 (12GB). I'm using Strata 0.2.0-beta under linux / cachyOS
Author
Owner

@github-actions[bot] commented on GitHub (Oct 19, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".
  • Add the Strata version (Settings > About, or strata --version).
  • Add your graphics card with its VRAM, your RAM and your operating system.

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6274507654 --> @github-actions[bot] commented on GitHub (Oct 19, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". - [ ] Add the Strata version (Settings > About, or `strata --version`). - [ ] Add your graphics card with its VRAM, your RAM and your operating system. Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Oct 19, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6274827129 --> @github-actions[bot] commented on GitHub (Oct 19, 2026): Thanks, this follows the format now.
Author
Owner

@Niko1221 commented on GitHub (Oct 20, 2026):

The help text was misleading, sorry. In the app there is nothing to switch: the app's own API (the address under Serving, port 47831 or the next free one) already answers browser pages from any site, so your web apps can call it without a cors_origins entry. cors_origins belongs to the engine's own server (the port in your json, 8080 by default), which the app keeps internal. The "Allow browser origins" switch in the Expert parameters does nothing in the app; its help line now says that, where CORS really is, and how to limit it, in all eight languages. DETAILS.md says the same.

This is in Strata 0.2.1: https://github.com/Niko1221/Strata/releases/tag/v0.2.1

<!-- gh-comment-id:6286735328 --> @Niko1221 commented on GitHub (Oct 20, 2026): The help text was misleading, sorry. In the app there is nothing to switch: the app's own API (the address under Serving, port 47831 or the next free one) already answers browser pages from any site, so your web apps can call it without a cors_origins entry. cors_origins belongs to the engine's own server (the port in your json, 8080 by default), which the app keeps internal. The "Allow browser origins" switch in the Expert parameters does nothing in the app; its help line now says that, where CORS really is, and how to limit it, in all eight languages. DETAILS.md says the same. This is in Strata 0.2.1: https://github.com/Niko1221/Strata/releases/tag/v0.2.1
Author
Owner

@MaKla89 commented on GitHub (Oct 21, 2026):

Hmm, I've tried it a couple of times again, but with 0.2.1 (as with 0.2.0) I can't connect my local (=same LAN but different machine) chat to strata, but if I use the "old" terminal version of strata (with manually changed port to be the same as in the app) it works.

I have given strata the task to debug my chat app, but it states that the strata app seems to be missing XCOR support.

<!-- gh-comment-id:6312017497 --> @MaKla89 commented on GitHub (Oct 21, 2026): Hmm, I've tried it a couple of times again, but with 0.2.1 (as with 0.2.0) I can't connect my local (=same LAN but different machine) chat to strata, but if I use the "old" terminal version of strata (with manually changed port to be the same as in the app) it works. I have given strata the task to debug my chat app, but it states that the strata app seems to be missing XCOR support.
Author
Owner

@MaKla89 commented on GitHub (Oct 21, 2026):


Here's Strata's own assessment of the situation in my case. Minimal chatbot is hosted on my NAS. Chatbot is engaged via either the machine I'm having strata running on or by my mobile. With Strata App, nothing works, with the old strata, everything works (once "cors_origins" have been added to the config).

============================================

CORS preflight fails on /v1/* — no Access-Control-* headers; auth middleware intercepts OPTIONS

A browser client (origin http://<NAS-IP>:9999) calls the API on port 47832 with a standard cross-origin fetch + Authorization: Bearer … header — the canonical OpenAI-compatible browser scenario. The browser's spec-mandated preflight fails:

... blocked by CORS policy: Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.

Probes against the server itself (2026-10-21, curl only — no client involved):

Request Response CORS headers
GET /v1/models + valid key + Origin: http://<NAS-IP>:9999 200 OK (correct model list) none
OPTIONS /v1/models (browser-style preflight, no auth — as the spec requires) 401 {"error":"Invalid API key"} none
curl -si -X OPTIONS http://<host>:47832/v1/models \
  -H 'Origin: http://example.org' \
  -H 'Access-Control-Request-Method: GET' \
  -H 'Access-Control-Request-Headers: authorization,content-type'
# → HTTP/1.1 401, no Access-Control-Allow-Origin

Two server-side issues:

  1. No Access-Control-Allow-Origin on any response, for any origin.
  2. API-key check runs before preflight handling. Browsers never send Authorization on a preflight, so it always 401s — no client can work around this.

Fix: short-circuit OPTIONS /v1/* before auth → 204 with Access-Control-Allow-Origin (echo origin or allowlist), Allow-Methods: GET, POST, OPTIONS, Allow-Headers: authorization, content-type (+ Max-Age: 600); and add Allow-Origin to GET/POST responses too. If CORS is opt-in via a flag, please document it — I found no setting enabling it on this build.

The API itself works fine (valid key → 200 + model list); this is purely missing CORS handling.

==============================================

<!-- gh-comment-id:6315195106 --> @MaKla89 commented on GitHub (Oct 21, 2026): --- Here's Strata's own assessment of the situation in my case. Minimal chatbot is hosted on my NAS. Chatbot is engaged via either the machine I'm having strata running on or by my mobile. With Strata App, nothing works, with the old strata, everything works (once "cors_origins" have been added to the config). ============================================ **CORS preflight fails on `/v1/*` — no `Access-Control-*` headers; auth middleware intercepts `OPTIONS`** A browser client (origin `http://<NAS-IP>:9999`) calls the API on port `47832` with a standard cross-origin `fetch` + `Authorization: Bearer …` header — the canonical OpenAI-compatible browser scenario. The browser's spec-mandated preflight fails: ``` ... blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. ``` Probes against the server itself (2026-10-21, curl only — no client involved): | Request | Response | CORS headers | |---|---|---| | `GET /v1/models` + valid key + `Origin: http://<NAS-IP>:9999` | `200 OK` (correct model list) | **none** | | `OPTIONS /v1/models` (browser-style preflight, no auth — as the spec requires) | `401 {"error":"Invalid API key"}` | **none** | ```bash curl -si -X OPTIONS http://<host>:47832/v1/models \ -H 'Origin: http://example.org' \ -H 'Access-Control-Request-Method: GET' \ -H 'Access-Control-Request-Headers: authorization,content-type' # → HTTP/1.1 401, no Access-Control-Allow-Origin ``` Two server-side issues: 1. **No `Access-Control-Allow-Origin` on any response**, for any origin. 2. **API-key check runs before preflight handling.** Browsers never send `Authorization` on a preflight, so it always 401s — no client can work around this. Fix: short-circuit `OPTIONS /v1/*` before auth → `204` with `Access-Control-Allow-Origin` (echo origin or allowlist), `Allow-Methods: GET, POST, OPTIONS`, `Allow-Headers: authorization, content-type` (+ `Max-Age: 600`); and add `Allow-Origin` to GET/POST responses too. If CORS is opt-in via a flag, please document it — I found no setting enabling it on this build. The API itself works fine (valid key → 200 + model list); this is purely missing CORS handling. ==============================================
Author
Owner

@MaKla89 commented on GitHub (Oct 23, 2026):

I (well... mostly Qwen, I'll be honest, sorry... :D) opened #3853 with a fix, since I could reproduce this on my own machine and the
cause turned out to be something specific.

The app has two listeners, and only one of them handled CORS. The address under Serving (port 47831) is started on loopback only by the desktop shell, so a second device can never reach it — the address a second device has to use is the shared one (47832), and that listener sent no CORS headers at all. It passed OPTIONS straight into the same handler that checks the API key first, and a browser never sends a key on a preflight, so every preflight came back 401. That is exactly the table I posted above, and it is why the Terminal version worked for me and the app did not.

The fix answers the preflight on the shared listener and puts the headers on every answer, in the same shape the engine's own server already uses. One thing worth a maintainer's eye: it only does this when an API key is set. Without a key the listener behaves exactly as before, because a keyless share is documented as reaching devices on my network, and a web page can point its own name at a LAN address — unconditional * there would quietly widen that. With a key the key is the gate and * is safe.

What I checked: the probes from my comment, run against a real host with sharing on, at v0.2.3.1 and at the fix commit — 401 with no headers before, 204 with them after, and the 200 now carries Access-Control-Allow-Origin. npm test in apps/host passes apart from one pre-existing failure (timeskip-real.test.mjs, which fails the same way at v0.2.3.1 and does not touch this code).

What I have not checked: a real model loaded on a GPU, and a real browser on a second device. I'll run both against the branch and report back here.

<!-- gh-comment-id:6368141924 --> @MaKla89 commented on GitHub (Oct 23, 2026): I (well... mostly Qwen, I'll be honest, sorry... :D) opened #3853 with a fix, since I could reproduce this on my own machine and the cause turned out to be something specific. The app has two listeners, and only one of them handled CORS. The address under Serving (port 47831) is started on loopback only by the desktop shell, so a second device can never reach it — the address a second device has to use is the shared one (47832), and that listener sent no CORS headers at all. It passed OPTIONS straight into the same handler that checks the API key first, and a browser never sends a key on a preflight, so every preflight came back 401. That is exactly the table I posted above, and it is why the Terminal version worked for me and the app did not. The fix answers the preflight on the shared listener and puts the headers on every answer, in the same shape the engine's own server already uses. One thing worth a maintainer's eye: it only does this when an API key is set. Without a key the listener behaves exactly as before, because a keyless share is documented as reaching devices on my network, and a web page can point its own name at a LAN address — unconditional `*` there would quietly widen that. With a key the key is the gate and `*` is safe. What I checked: the probes from my comment, run against a real host with sharing on, at v0.2.3.1 and at the fix commit — 401 with no headers before, 204 with them after, and the 200 now carries `Access-Control-Allow-Origin`. `npm test` in `apps/host` passes apart from one pre-existing failure (`timeskip-real.test.mjs`, which fails the same way at v0.2.3.1 and does not touch this code). What I have not checked: a real model loaded on a GPU, and a real browser on a second device. I'll run both against the branch and report back here.
Author
Owner

@Niko1221 commented on GitHub (Oct 24, 2026):

This is fixed in Strata 0.2.1. Please update to the latest release (in the Terminal: strata update; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report.

<!-- gh-comment-id:6383459813 --> @Niko1221 commented on GitHub (Oct 24, 2026): This is fixed in Strata 0.2.1. Please update to the latest release (in the Terminal: `strata update`; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report.
Author
Owner

@MaKla89 commented on GitHub (Oct 24, 2026):

13. This is fixed in Strata 0.2.1. Please update to the latest release (in the Terminal: strata update; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report.

Thanks for your reply, but I've always run updated version and in my PR and its Tests I've been testing against at least 0.2.3.0 as the baseline with no success

<!-- gh-comment-id:6384588002 --> @MaKla89 commented on GitHub (Oct 24, 2026): > 13\. This is fixed in Strata 0.2.1. Please update to the latest release (in the Terminal: `strata update`; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report. Thanks for your reply, but I've always run updated version and in my PR and its Tests I've been testing against at least 0.2.3.0 as the baseline with no success
Author
Owner

@octal-ip commented on GitHub (Oct 25, 2026):

+1 for this issue, the latest version is still not returning the expected Access-Control headers, breaking CORS.

<!-- gh-comment-id:6396810914 --> @octal-ip commented on GitHub (Oct 25, 2026): +1 for this issue, the latest version is still not returning the expected Access-Control headers, breaking CORS.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1300
No description provided.