Search code examples
flutterwebview-flutter

Web-view Flutter not sending "origin" and "referer" with the request headers


I am trying to request an URL with the Web-view Flutter Library

upon Checking the request I can see that its missing the two Header components - Origin and referer Which is required for handling the request.

As per my knowledge it should be automatically added with the request.

enter image description here


Solution

  • In flutter_webview case we can utilise the onPageStarted callback method and implant the header

    onWebViewCreated: (WebViewController webViewController) {
                    this.webViewController = webViewController;
                  },
    onPageStarted: (url) {
                    webViewController.loadUrl(url, headers: headers);
                  },