fix(core): dynamic CORS origin for asset protocol handler#15172
Open
xingzihai wants to merge 1 commit intotauri-apps:devfrom
Open
fix(core): dynamic CORS origin for asset protocol handler#15172xingzihai wants to merge 1 commit intotauri-apps:devfrom
xingzihai wants to merge 1 commit intotauri-apps:devfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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