Skip to content

config: document request restrictions of the no-cors fetch mode - #100

Merged
rameel merged 1 commit into
mainfrom
no-cors-mode-docs
Oct 13, 2026
Merged

rameel merged 1 commit into
mainfrom
no-cors-mode-docs

Conversation

@rameel

@rameel rameel commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

The documentation for HtmxFetchMode.NoCors described only opaque responses. In no-cors mode, the browser also:

  • allows only GET, HEAD, and POST; for other methods, fetch throws and HTMX raises htmx:error;
  • drops request headers that are not CORS-safelisted, even for same-origin requests. The server receives no HX-* headers, hx-headers values, or antiforgery token sent in a header, so IsHtmxRequest() and [HtmxRequest] do not recognize the request.

Opaque responses apply only to cross-origin requests.

In no-cors mode, the browser rejects methods other than GET, HEAD, and
POST and drops request headers that are not CORS-safelisted, including
HX-* headers, even for same-origin requests.

The XML remarks and the HTMX 4.x configuration guide described only
opaque responses, which apply only to cross-origin requests.
@rameel
rameel merged commit e4ffeeb into main Oct 13, 2026
1 check passed
@rameel
rameel deleted the no-cors-mode-docs branch October 13, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant