Skip to content

[Bug]: Android ERR_CONNECTION_REFUSED when redirecting from external url back to https://localhost #7367

Description

@atremel

Capacitor Version

Latest Dependencies:

@capacitor/cli: 5.7.4
@capacitor/core: 5.7.4
@capacitor/android: 5.7.4
@capacitor/ios: 5.7.4

Installed Dependencies:

@capacitor/cli: 5.7.3
@capacitor/core: 5.7.3
@capacitor/android: 5.7.3
@capacitor/ios: 5.7.3

[success] Android looking great! 👌

Other API Details

npm --version -> 10.2.1
node --version -> v18.18.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

The app is redirecting to an external auth service. From there the user is redirected 302 back to https://localhost, where the browser blocks the request saying ERR_CONNECTION_REFUSED:

image

HTTPS is encouraged: "we would strongly recommend that you change your androidScheme to use https."

capacitor.config.ts looks like this:

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.somedomain.app',
  appName: 'App',
  webDir: 'dist/prod',
  server: {
    androidScheme: 'https',
    allowNavigation: [
      "login.somedomain.com"
    ]
  },
  plugins: {
    CapacitorHttp: {
      enabled: true,
    },
  },
};

export default config;

Expected Behavior

Redirect to https://localhost is successful.

Project Reproduction

https://github.com/atremel/redir

Additional Information

Real device has this issue, too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions