Skip to content

HTTP traffic via company MDM VPN tunnel #41500

@Mardaneus86

Description

@Mardaneus86

I'm trying to develop an in-house app for deployment within our company. This requires the use of a VPN tunnel which is provided by Mobile Iron (MDM solution). When I try to reach the internal API through Flutter I can see the app opens the VPN tunnel, but I'm getting an exception message that the connection failed using the following code (exact logs below):

import 'package:http/http.dart' as http;
// ...
var client = http.Client();
return await client.get(
  'https://internal-api.internalcorp.net:8443/api/<!--redacted-->',
);

The same issue exists using either the dart:io or the http package.

I tried implementing the HTTP calls in native iOS and call that via a method channel using the exact same details, and that seems to work okay. So I'm thinking that the http implementation in Flutter does something different than the native iOS http client via URLRequest:

let session = URLSession.shared

let url = URL(string: "https://internal-api.internalcorp.net:8443/api/<!--redacted-->")!
var request = URLRequest(url: url)

let task = session.dataTask(with: request) { data, response, error in
    result([
        "data": String(data: data!, encoding: .utf8)!,
        "statusCode": (response as? HTTPURLResponse)?.statusCode
    ]);
}

task.resume()

I'm not a Swift expert so the above code could probably be implemented in a better way.

PS: We only support iOS with our MDM solution, so I'm unable to test if the issue exists for Android as well.

Steps to Reproduce

I did not find a way to reproduce the issue outside of the company environment yet. I tried getting more insight on the network calls but can't find anything since the traffic is all encrypted via the tunnel.

Logs

Redacted a little to prevent exposing secure details.

[ +763 ms] [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: SocketException: Connection failed, address =
internal-api.internalcorp.net, port = 8443
[        ] #0      IOClient.send (package:http/src/io_client.dart:33:23)
[        ] <asynchronous suspension>
[        ] #1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:169:38)
[        ] <asynchronous suspension>
[        ] #2      BaseClient.get (package:http/src/base_client.dart:32:7)
[        ] #3      Test.getData (package:example/test.dart:8:25)
[        ] <asynchronous suspension>
[        ] #4      _LoginPageState.build.<anonymous closure> (package:example/main.dart:160:53)
[        ] <asynchronous suspension>
[        ] #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:635:14)
[        ] #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:711:32)
[        ] #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
[        ] #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
[        ] #9      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)
[        ] #10     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)
[        ] #11     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)
[        ] #12     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)
[        ] #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
[        ] #14     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
[   +4 ms] #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
[        ] #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
[        ] #17     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
[        ] #18     _rootRunUnary (dart:async/zone.dart:1136:13)
[        ] #19     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
[        ] #20     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
[        ] #21     _invoke1 (dart:ui/hooks.dart:250:10)
[        ] #22     _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)
[ +302 ms] [VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception:
[        ] Bad state: Future already completed
[        ] #0      _AsyncCompleter.complete (dart:async/future_impl.dart:39:31)
[        ] #1      _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io-patch/socket_patch.dart:521:23)
[        ] #2      _NativeSocket.issueWriteEvent.issue (dart:io-patch/socket_patch.dart:874:14)
[        ] #3      _NativeSocket.issueWriteEvent (dart:io-patch/socket_patch.dart:881:12)
[        ] #4      _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:902:11)
[        ] #5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
[✓] Flutter (Channel master, v1.10.7-pre.25, on Mac OS X 10.14.4 18E226, locale en-NL)
    • Flutter version 1.10.7-pre.25 at /Users/tim/development/flutter
    • Framework revision e47a1dc216 (29 hours ago), 2019-09-26 07:18:25 -0700
    • Engine revision 9fd35df9bb
    • Dart version 2.6.0 (build 2.6.0-dev.0.0 dd65f97118)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/tim/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.0, Build version 11A420a
    • CocoaPods version 1.7.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 35.3.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.38.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listdependency: dartDart team may need to help usdependency: dart:ioIssue in 'dart:io' libraryengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions