AS-Devs / signalr_flutter

A flutter plugin for .net SignalR client.
https://pub.dev/packages/signalr_flutter
MIT License
18 stars 28 forks source link

[iOS] WebView - Origin in requests headers is always null #14

Closed LukaszSadoch closed 3 years ago

LukaszSadoch commented 3 years ago

In webview I'a getting error: Origin null is not allowed by Access-Control-Allow-Origin

My flutter app connects to server with CORS mechanism, so null is not acceptable. Adding an 'Origin' header to SignalR configuration doesn't help either.

I don't know how to change Origin to any value, but after adding allowUniversalAccessFromFileURLs to WKWebView it will be "file: //" which in my opinion is a better solution

LukaszSadoch commented 3 years ago

Suggestion of changes:

to file ios/Classes/SwiftR.swift:231 add: config.setValue(true, forKey: "allowUniversalAccessFromFileURLs")

AyonAB commented 3 years ago

Thanks for the suggestion, added this. Should be available in the next pre release.