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

fix(android): properly proxy requests to domains in allowNavigation #2146

Merged
merged 1 commit into from
Nov 6, 2019

Conversation

jcesarmobile
Copy link
Member

When there are urls in allowNavigation object, requests to those domains are being treated as local request instead of being proxied. This PR solves that.

Closes #2132

@roa-jyskebank-dk
Copy link

Great work!
When can we expect a release with this fix in it? 🤩

@qmarcos
Copy link

qmarcos commented Mar 5, 2021

Is this fix included in capacitor?
I'm working with 2.4.5 and I have the problem described on android when server.hostname is set to the same than the endpoint domain.

@jcesarmobile
Copy link
Member Author

This was released on 2.4.7, but it's not the same problem as you describe

@qmarcos
Copy link

qmarcos commented Mar 5, 2021

@jcesarmobile Thanks a lot for your quick response.

I thought was related... 😢

We have to use server.hostname to solve cookie session management based on headers on iOS (#1373), but that setting cause that on android app doesn't work when requesting a JSON from an endpoint hosted on the domain used on hostname.

Debugging the problem with dev tools from the android simulator I understand that this is because request is intercepted as "local" one (request response shows shouldInterceptRequest ), it seems I was wrong on this assumption :(

Simply removing this server setting (I understand then it works as localhost) and problems disappears pon android.

@qmarcos
Copy link

qmarcos commented Mar 5, 2021

@jcesarmobile you are right.

I have upgraded to 2.4.7 and problem persists, I think I have no alternative and do specific compilations for ios / android changing this configuration settings 🤦‍♂️

@valdu02100
Copy link

Hello everyone.

I had the problem with my vue.js application and capacitor app in android studio.
If your application is hosted on a web server and in production there is a rather radical solution.

-> Use a subdomain such as "sub.domain.com" and set up SSL.
->In the capacitor.config.json configuration file, add:

"server": {
     "url": "https://sub.domain.com",
     "allowNavigation": [
       "* .domain.com",
     ]
   },

Important note, all requests made within your application must be in HTTPS.

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

Successfully merging this pull request may close these issues.

bug: Cors error
4 participants