How to modify the headers of a response? #6187
-
I need to set "Access-Control-Allow-Origin" for the response, but I can't find |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
The And the upstream feature request: MicrosoftEdge/WebView2Feedback#2355 - Note that this does not exist on the linux and macos webviews either (but worse because you can't modify requests either). Also in case it may be helpful for other issues, you need to use the let core_2 = webview // `webview` is the arg you get in tauri's window.with_webview method.
.controller()
.CoreWebView2()
.unwrap()
.cast::<ICoreWebView2_2>()
.unwrap(); |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hello, I also have the same problem. Have you solved it?
I've already tried this
and run this code
but still get this
I think it's a version problem as mentioned above, but I don't know how to find the corresponding version |
Beta Was this translation helpful? Give feedback.
-
@FlysoftBeta did you find a solution for this? I'm looking for the same thing |
Beta Was this translation helpful? Give feedback.
The
WebResourceResponseReceived
event can not be used to modify the Responses, only to monitor them. If you want to modify a Response, you need to listen to theWebResourceResourceRequested
event, cancel the request, do your own request stuff (viareqwest
for example), modify that response and then send it back to the webview. Example from Microsoft docs: https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/webresourcerequested?tabs=dotnet#example-overriding-a-response-to-proactively-replace-itAnd the upstream feature request: MicrosoftEdge/WebView2Feedback#2355 - Note that this does not exist on the linux and macos webviews either (but worse because you can't modify requests…