You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide better error messages about disabled insecure HTTP connections #69685
Can we update the error message to include the fix? Instead of just saying that HTTP is blocked, we could tell people to either a) replace the URL with an HTTPS connection or b) enable HTTP (with all the caveats)
This is the kind of friction point that we can easily mitigate.
We can consider changing the Flutter Android embedding to add 10.0.2.2 to the list of allowed addresses. I would not want to do this because it would mean release apps are also allowed to connect to this address and that's not good.
We could change the flutter tooling to add android:usesCleartextTraffic="true" automatically to debug AndroidManifest.xml so users don't run into issues while debugging. I am not sure how feasible it is but I have seen similar code changes to tooling for iOS 14 that required additional plist attributes for debugging. I don't have bandwidth to do this unfortunately.
It is unlikely that we can provide a 2-3 sentence solution. It will be more confusing. For instance, in most cases, HTTPS is not feasible. What if I just want to debug something? What if I am trying to connect to my local server? Allowing all cleartext traffic has serious caveats that won't fit to an error message. For instance, Apple might reject your app.
I am all for lower friction but it doesn't feel like we can do much else here. If you have an exact error message in mind, happy to hear it :)
I think a simple message that says something like "Change your app to use
the HTTPS protocol, or visit this page for other solutions:
https://blah.blah.blah" or similar will be just fine, honestly. Even if
it's the #1 search result, we should do everything we can to signpost
solutions. Does that make sense?
On Fri, Nov 6, 2020 at 5:40 PM Mehmet Fidanboylu ***@***.***> wrote:
I have opened a PR to update the main article. Right now, the #1
<#1> google hit when someone
searches this error message + flutter is
https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android
.
It is unlikely that we can provide a 2-3 sentence solution. It will be
more confusing. For instance, in most cases, HTTPS is not feasible. What if
I just want to debug something? What if I am trying to connect to my local
server? Allowing all cleartext traffic has serious caveats that won't fit
to an error message. For instance, Apple might reject your app.
I am all for lower friction but it doesn't feel like we can do much else
here. If you have an exact error message in mind, happy to hear it :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#69685 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARWL66PCXSYUVZOG42UMR3SOSQPTANCNFSM4TJAASMA>
.
@zanderso is the current status that insecure network connections are disabled with no way to enable them -- and that we want to allow app-level overrides by plumbing through platform-native configuration directives (such as android:usesCleartextTraffic for Android)?
If so, I propose we close this bug (since the error messages have been improved) and open bugs for Android and iOS.
At the moment, the default value of the flag allows insecure connections to any domain. Internal tooling may override that default, but I don't have a pointer to that code handy.
However, to clarify, when insecure connections are disabled, the check can be bypassed by setting #flutter.io.allow_http to true in a Zone that will be active while setting up the connection. The check is also not done for connections to localhost. The logic is here:
At the moment, the default value of the flag allows insecure connections to any domain. Internal tooling may override that default, but I don't have a pointer to that code handy.
the current status that insecure network connections are disabled with no way to enable them -- and that we want to allow app-level overrides by plumbing through platform-native configuration directives (such as android:usesCleartextTraffic for Android)?
...the error messages have been improved...
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
tvolkert commentedon Nov 3, 2020
@mehmetf can we fix this before the next stable cut?
tvolkert commentedon Nov 3, 2020
FYI @timsneath
mehmetf commentedon Nov 3, 2020
Possible things we can do:
Include a link in the error message that explains all this such as: https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android. I think embedding all this information in the error message itself is likely too much. I can push this through.
We can consider changing the Flutter Android embedding to add
10.0.2.2to the list of allowed addresses. I would not want to do this because it would mean release apps are also allowed to connect to this address and that's not good.We could change the flutter tooling to add android:usesCleartextTraffic="true" automatically to debug AndroidManifest.xml so users don't run into issues while debugging. I am not sure how feasible it is but I have seen similar code changes to tooling for iOS 14 that required additional plist attributes for debugging. I don't have bandwidth to do this unfortunately.
mehmetf commentedon Nov 7, 2020
I have opened a PR to update the main article. Right now, the #1 google hit when someone searches this error message + flutter is https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android.
It is unlikely that we can provide a 2-3 sentence solution. It will be more confusing. For instance, in most cases, HTTPS is not feasible. What if I just want to debug something? What if I am trying to connect to my local server? Allowing all cleartext traffic has serious caveats that won't fit to an error message. For instance, Apple might reject your app.
I am all for lower friction but it doesn't feel like we can do much else here. If you have an exact error message in mind, happy to hear it :)
timsneath commentedon Nov 8, 2020
mehmetf commentedon Nov 9, 2020
Upstream Dart CL open for this: https://dart-review.googlesource.com/c/sdk/+/171020
17 remaining items
tvolkert commentedon Oct 22, 2021
@zanderso is the current status that insecure network connections are disabled with no way to enable them -- and that we want to allow app-level overrides by plumbing through platform-native configuration directives (such as
android:usesCleartextTrafficfor Android)?If so, I propose we close this bug (since the error messages have been improved) and open bugs for Android and iOS.
zanderso commentedon Oct 23, 2021
Further platform specific plumbing is needed, yes. It would need to toggle the engine flag here:
https://github.com/flutter/engine/blob/b71a2fd8f50ecd66b7e65192ef3077a7d0d76f52/common/settings.h#L144
At the moment, the default value of the flag allows insecure connections to any domain. Internal tooling may override that default, but I don't have a pointer to that code handy.
However, to clarify, when insecure connections are disabled, the check can be bypassed by setting
#flutter.io.allow_httptotruein aZonethat will be active while setting up the connection. The check is also not done for connections tolocalhost. The logic is here:https://github.com/flutter/engine/blob/master/lib/ui/hooks.dart#L233
aam commentedon Oct 24, 2021
external engine flag
disallow-insecure-connectionswith default value is defined here https://github.com/flutter/engine/blob/b71a2fd8f50ecd66b7e65192ef3077a7d0d76f52/shell/common/switches.h#L192flipped over from "disallow" to
may_insecurely_connect_to_all_domainsfor internal use here:https://github.com/flutter/engine/blob/b71a2fd8f50ecd66b7e65192ef3077a7d0d76f52/shell/common/switches.cc#L261
aam commentedon Feb 24, 2023
@tvolkert wrote
@zanderso wrote
That's the current state of things.
gmackall commentedon Sep 28, 2023
From Android triage: It looks like the error messages themselves have been fixed, which is what the original issue was about.
At this point any follow up work for platform-specific plumbing should be filed as a separate issue. Please feel free to re-open if you disagree!
github-actions commentedon Oct 12, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.