Skip to content

Enable CORS + HTTP Range support for browser partial reads on cas-bridge.xethub.hf.co (Parquet row-group access) #7931

Description

@cornhundred

Feature request

Summary

Browser-based data tools need Range requests to read Parquet efficiently (footer + selected row groups). Downloads from the Hub redirect to cas-bridge.xethub.hf.co (Xet bridge). The redirected host fails CORS preflight for Range/HEAD workflows, blocking partial reads. (Hugging Face). See example HuggingFace dataset

Current behavior

Plain GET works via redirect.
Range workflows fail with: “Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.”
This blocks parquet-wasm and DuckDB-Wasm style readers which rely on HEAD + Range or non-safelisted Range patterns. (GitHub)

Expected behavior

OPTIONS to the final redirected host returns 200/204 (no redirect) with appropriate CORS headers. Preflight responses must be “ok” status. (GitHub)
GET with Range returns 206 Partial Content and includes CORS headers, plus exposes Content-Range, Accept-Ranges, and Content-Length so browser JS can consume them. (MDN WebDocument)

Proposed CORS headers (public, anonymous files)

For responses from cas-bridge.xethub.hf.co (and any sibling Xet bridge hosts):

Preflight (OPTIONS)

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD, OPTIONS
Access-Control-Allow-Headers: Range, Content-Type (or echo Access-Control-Request-Headers)
Access-Control-Max-Age: 86400 (optional, reduces preflight spam)

Actual (GET/HEAD, including 206)

Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Range, Accept-Ranges, Content-Length
Ensure Accept-Ranges: bytes and Content-Range are present for range responses. (MDN WebDocument)

Notes on credentials (optional)

If any endpoint requires credentials, wildcard * cannot be used and the server must echo Origin and add Vary: Origin. (MDN WebDocument)

Impact

This unblocks efficient browser analytics and visualization on HF-hosted datasets using Parquet row groups, DuckDB-Wasm, parquet-wasm, and similar tooling. DuckDB-Wasm documentation explicitly notes that remote data access requires correct CORS on the hosting site. (DuckDB)

High-quality references worth linking in the issue thread
Hugging Face: redirect to cas-bridge.xethub.hf.co shown in Xet migration blog (Hugging Face)
Fetch/CORS: preflight must be “ok” status (200/204) (GitHub)
Fetch/CORS: redirect + preflight is a known sharp edge (GitHub)
MDN CORS guide: Range safelist caveat (MDN WebDocument)
MDN Range header: single-range is safelisted, multi-range may preflight (MDN WebDocument)
MDN Expose-Headers: non-safelisted headers must be exposed (MDN WebDocument)
DuckDB-Wasm: remote HTTPFS requires correct CORS (DuckDB)
DuckDB-Wasm issue: HEAD blocked by CORS breaks the pipeline (GitHub)
pdf.js historical issues about Accept-Ranges/Content-Range exposure (GitHub)

Summary

Your request is standard: browser Parquet needs byte ranges.
Redirect to cas-bridge.xethub.hf.co makes CORS enforcement happen on the Xet bridge host. (Hugging Face)
Fix requires: OPTIONS returns 200/204 with CORS headers, and 206 responses include CORS + exposed headers. (GitHub)
Similar failures exist across pdf.js and DuckDB-Wasm ecosystems. (GitHub)

Motivation

I would like to be able to read subsets of large Parquet files using range requests using the parquet_wasm library on the front end. This is being used as part of a spatial data visualization project https://github.com/broadinstitute/celldega

Your contribution

I would be happy to provide code to make front-end range requests as an example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions