Skip to content

fix(core): dynamic CORS origin for asset protocol handler#15172

Open
xingzihai wants to merge 1 commit intotauri-apps:devfrom
xingzihai:fix/issue-14852-dynamic-cors-asset-loading
Open

fix(core): dynamic CORS origin for asset protocol handler#15172
xingzihai wants to merge 1 commit intotauri-apps:devfrom
xingzihai:fix/issue-14852-dynamic-cors-asset-loading

Conversation

@xingzihai
Copy link
Copy Markdown

Fixes #14852

Problem

The asset protocol handler was not properly handling dynamic CORS origins, causing issues when loading assets from different origins.

Solution

Implemented dynamic CORS origin handling in the asset protocol handler to properly respond to requests from various origins.

Testing

  • Tested with multiple origin configurations
  • Verified CORS headers are correctly set
  • Asset loading works correctly across different origins

Issue tauri-apps#14852: Application windows without URL are unable to load assets

Root cause: The Access-Control-Allow-Origin header was set to a static
window_origin value. When windows don't have a URL, window_origin is empty
or incorrect, causing CORS failures.

Fix: Make the CORS origin dynamic by:
1. First checking the request's Origin header
2. Falling back to window_origin if no Origin header present
3. Using "*" as a last resort for windows without URL

This allows windows without a URL to load assets from the asset protocol
handler by properly handling CORS.
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📬Proposal

Development

Successfully merging this pull request may close these issues.

[bug] Application windows without URL (or "about:blank") are unable to load assets

1 participant