Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_CLEARTEXT_NOT_PERMITTED #30368

Closed
StephanCassel opened this issue Apr 2, 2019 · 4 comments

Comments

@StephanCassel
Copy link

commented Apr 2, 2019

Using webview_flutter: ^0.3.2+1

I get ERR_CLEARTEXT_NOT_PERMITTED for Android and blank page for iOS when I use
http:// urls. https:// urls seems to work.
The very same http:// urls works fine in Chrome.

I recall I had the same problem in native Android as well.
Is possible to tell webview "please use http://. I will take the risk"

Thanks in advanced

@adesugbaa

This comment has been minimized.

Copy link

commented Apr 5, 2019

Open the android manifest file (android/app/src/main/AndroidManifest.xml) and add

android:usesCleartextTraffic="true"

to the application tag

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="tangerine_ui"
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true">
@StephanCassel

This comment has been minimized.

Copy link
Author

commented Apr 7, 2019

Thanks for you replay.
I have tried that but got the same result and I guess it only help Android. iOS just shows a white screen.
My solution was to open HTTPS in webview and HTTP in an external browser.
Good enough

@adesugbaa

This comment has been minimized.

Copy link

commented Apr 8, 2019

For IOS, you need to modify the info.plist (ios/Runner/info.plist)

Add the following:

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
</dict>

You may need to be more explicit with the whitelist of http domains you need to support before releasing to the Apple Store.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>yourdomain.com</key>
        <dict>
            <!--Include to allow subdomains-->
            <key>NSIncludesSubdomains</key>
            <true/>
            <!--Include to allow HTTP requests-->
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <!--Include to specify minimum TLS version-->
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
        </dict>
    </dict>
</dict>
@fideldonson

This comment has been minimized.

Copy link

commented Aug 15, 2019

As far as i can tell this is still an issue in flutter. The usesCleartextTraffic works in native development but with flutter the 'ERR_CLEARTEXT_NOT_PERMITTED' persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.