capacitor: bug: setting anything in "allowNavigation" capacitor.config.json will provoke ERR_CONNECTION_REFUSED

Bug Report

Capacitor Version

npx cap doctor output:

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 1.4.0

@capacitor/core: 1.4.0

@capacitor/android: 1.4.0

@capacitor/ios: 1.4.0

Installed Dependencies:

@capacitor/cli 1.4.0

@capacitor/android 1.4.0

@capacitor/core 1.4.0

@capacitor/ios 1.4.0

[error] Main Acitivity “.MainActivity” is not in manifest package “com.bubblevr.wedo”. Please update the packages to be the same.

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

In order to fix some access issue (XHR call to these domains would be cancelled on iOS without it) I am setting the following json in capacitor.config.json

"server": { "allowNavigation": [ "localhost", "ec2-35-181-50-61.eu-west-3.compute.amazonaws.com:1337", "ec2-15-188-204-14.eu-west-3.compute.amazonaws.com:1337", "wedo-front-1670696535.eu-west-3.elb.amazonaws.com" ] }

But as soon as I set these, I get an error page on load of the app on android "the webpage at http://localhost/ could not be loaded because : net::ERR_CONNECTION_REFUSED. Screenshot 2020-01-30 at 14 22 44

I have also tried adding “*” in the listed of allowed origins, but I cannot get it to work. Removing the “allowNavigation” array will let my app load properly.

Expected Behavior

Application load should not be blocked.

Other Technical Details

npm --version output: 6.4.1 node --version output: v11.0.0

pod --version output (iOS issues only):

Other Information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 22 (3 by maintainers)

Most upvoted comments

Question similar to this… I have the exact same issue however, I don’t have “localhost” in “allowNavigation”. I have my auth provider url in “allowNavigation” only.

The idea is for the app to redirect to the auth provider, show the user the login flow, then redirect back to http://localhost/callback/…

But I get the connect refused screen above.

Any other ideas?

image

Question similar to this… I have the exact same issue however, I don’t have “localhost” in “allowNavigation”. I have my auth provider url in “allowNavigation” only.

The idea is for the app to redirect to the auth provider, show the user the login flow, then redirect back to http://localhost/callback/…

But I get the connect refused screen above.

Any other ideas?

image

same thing, still looking for solution

Add flag --external when emulating Android device. That will write external IP in the capacitor config instead of usual ‘localhost’

can you try removing “localhost”? a sample app would help too