capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

bug: Android https scheme fetches capacitor.js

Open Webrow opened this issue 3 years ago • 0 comments

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

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

Installed Dependencies:

  @capacitor/cli: 3.3.3
  @capacitor/core: 3.4.1
  @capacitor/android: 3.4.1
  @capacitor/ios: 3.4.1

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

My application uses cookie session authentication. iOS Blocks third party cookies based on ITP . To work with this a user can set server.hostname in the capacitor config. Working with iOS this nicely binds the cookies on the HTTP plugin in further requests with the option withCredentials.

Working on android I get CORS issues when not using https, setting the scheme to HTTPS tho causes every call to be to https://hostname.example.com/login to return capacitor.js in the response.

Expected Behavior

It should point to the posturl endpoint (whats located at api.example.domain)

Code Reproduction

This is a pretty big code reproduction since it involves the backend. Sending a post (api.example.domain/login) to the same domain as set in server.hostname(api.example.domain) causes android to return capacitor.js

Other Technical Details

Please provide the following information with your request and any other relevant technical details (versions of IDEs, local environment info, plugin information or links, etc).

npm --version output: 8.5.2

node --version output: v14.17.6

pod --version output (iOS issues only):

Additional Context

I am running out of options a bit, since I am not well versed in CORS I do not know if its cause I am switching to HTTPS, or if this is also happening with the default scheme (http) and behaviour between android and ionic is this different.

Webrow avatar Feb 28 '22 14:02 Webrow