Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referrer header not added to HTTP request due to the use of a custom scheme (ionic://) #365

Closed
gabriele-sacchi opened this issue May 8, 2019 · 8 comments

Comments

@gabriele-sacchi
Copy link

I am using Cordova to build an iOS App and I use this Ionic engine (meaning that the app is served from a webserver running on the device).

My window.location.origin is "ionic://my-app.com".

A third party API (that I need to use in order to fetch an address suggestion based on what the user types) rejects my HTTP requests because the referrer header is missing in the request.

It's not possible to programmatically add a referrer from the JS layer and these did not work:

  • <meta name="referrer" content="origin">
  • <meta name="referrer" content="always">

I suspect that the issue is that the API is using https and my iOS App is using the custom scheme (ionic:// that cannot be changed to https). For this reason the referrer is not added by the WebView.

How can I resolve this? 😿
Thx

( stackoverflow -> here )

@amritk
Copy link

amritk commented Nov 5, 2019

Is there any way to just use https:// instead of ionic:// ?

@Yuripetusko
Copy link

@amritk Unfortunatly not :(, you can use http:// with older version of this plugin, but not https

@amritk
Copy link

amritk commented Nov 5, 2019

@Yuripetusko yea thats causing issues with the old component router that we're still using.
I tried poking around the source to fix it but had no luck. I will have to stick with version 2. Thanks

@amritk
Copy link

amritk commented Nov 5, 2019

Actually, @Yuripetusko do you know if its possible to use HTTPS with the older version?

@Yuripetusko
Copy link

@amritk as far as I know ios local webserver doesn't allow https

@ciekawy
Copy link

ciekawy commented Mar 17, 2020

shouldn't the preference Scheme solve this (as described in the README.md)?
https://github.com/ionic-team/cordova-plugin-ionic-webview

@ciekawy
Copy link

ciekawy commented Mar 19, 2020

unfortunately as mentioned above - no option to use standard http or https and referrer header is not being set.

@jcesarmobile
Copy link
Member

The plugin doesn't really do anything to fetch/XHR, that's provided by the webview, so you should report it to Apple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants