rknell / alfred

A performant, expressjs like server framework with a few gadgets that make life even easier.
Other
526 stars 29 forks source link

Flutter web insecure content #115

Closed jrheisler closed 1 year ago

jrheisler commented 1 year ago

Ryan, I'm not sure where to put this, but I wanted to share it with any users of Alfred using flutter web to connect. If your alfred server is not local and not providing ssl, https, Flutter released web aps will not support it. Your await http.get(...) will just hang.

Your flutter app will work in development, and while using localhost. But, once you go to another machine the browser takes over.

The fix is to either, get a cert, or change your browser's settings for your app to enable mixed content (secure and unsecure). You have a good example of using a cert, but to change your browsers settings google: browser allow insecure content

rknell commented 1 year ago

Hey Jeff,

Do you have some official guide / documentation about this? If so I will add it to the docs.

On Tue, 17 Jan 2023, 5:39 am Jeff Heisler, @.***> wrote:

Ryan, I'm not sure where to put this, but I wanted to share it with any users of Alfred using flutter web to connect. If your alfred server is not local and not providing ssl, https, Flutter released web aps will not support it. Your await http.get(...) will just hang.

Your flutter app will work in development, and while using localhost. But, once you go to another machine the browser takes over.

The fix is to either, get a cert, or change your browser's settings for your app to enable mixed content (secure and unsecure). You have a good example of using a cert, but to change your browsers settings google: browser allow insecure content

— Reply to this email directly, view it on GitHub https://github.com/rknell/alfred/issues/115, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABM2K3NZOG7KFNCJJZQVKHLWSWPXXANCNFSM6AAAAAAT5CU4EI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jrheisler commented 1 year ago

Ryan,

This would be it:

If using Flutter with any server that does not use HTTPS, you will have to do the following:

For Android and iOS: Following this Flutter guide - https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android

For Flutter Web: You can not enable insecure HTTP connections. Instead you have to allow mixed content (secure and unsecure) in the browser the web app is running on. For Chrome go to:

Settings/Privacy and security/Site Settings. Select your app. Select Allow for Insecure content

For other browsers search allowing insecure or mixed content.

Note: this is not needed when the Alfred server is run as localhost on the same machine as the app, or when you are using it while debugging.