ankicommunity / ankicommunity-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
870 stars 80 forks source link

Cannot connect to server through android app (probably because http) #133

Open posLop opened 2 years ago

posLop commented 2 years ago

i am unable to connect to my anki server through my phone. my laptop works perfectly fine however.

the error is CLEARTEXT communication to (ip address) is not permitted by network security policies

i read that this is caused by useing http and not https which is what im useing. i do not want to use https as i use a vpn called tailscale which is based on wireguard. all my traffic is already encrypted and i am not useing this for many people.

VikashKothary commented 2 years ago

Hi @posLop,

I'm happy to help you with your issue. Can you help my reproduce your issue? What exactly did you do to get this error?

Kiskadee-dev commented 2 years ago

@VikashKothary I have the same issue, i've setup the server a few days ago and anki desktop synced just fine.

The problem lies within Ankidroid and the android policy about sending credentials through http, which is right but expecting self hosted servers to use self signed certs isn't really productive.

I've also tried to setup ssl on a updated docker image (the current one doesn't work with the current anki version) + nginx as a proxy but failed as either i did something wrong or this project doesn't really support that... i'm not experienced enough about ssl/https to say

To reproduce: start the server, try to login with the latest ankidroid app

posLop commented 2 years ago

@VikashKothary I have the same issue, i've setup the server a few days ago and anki desktop synced just fine.

The problem lies within Ankidroid and the android policy about sending credentials through http, which is right but expecting self hosted servers to use self signed certs isn't really productive.

I've also tried to setup ssl on a updated docker image (the current one doesn't work with the current anki version) + nginx as a proxy but failed as either i did something wrong or this project doesn't really support that... i'm not experienced enough about ssl/https to say

To reproduce: start the server, try to login with the latest ankidroid app

I had the exact same issue. i initially started with bare http and the policy blocked me from accessing. i then setup a self signed https connection and anki would not connect. it seemed to me that https was not supported by the app

alexanderroese commented 2 years ago

Good day!

I have the same problem on my android phone. I set up a server and want to connect it with http from my phone and got the same error message. Is there already a solution? @Kiskadee-dev @posLop

Kiskadee-dev commented 2 years ago

@alexanderroese This project doesn't seem to support https as it uses a very old protocol, so even if we update the server version it won't work, that's what i've understood from my tests with nginx and (a very modified) docker version

It would be easier if the ankidroid devs set the https requirement as optional, its easier but well, it isn't great to send credentials over http anyway... so i've gave up on this

alexanderroese commented 2 years ago

Ok, thanks for the quick reply @Kiskadee-dev. Then I will put nginx as reverse proxy in front for the https connection.

posLop commented 2 years ago

when ibtried a reverse proxy i had the exact same issue

alexanderroese commented 2 years ago

Okay. I had the anki server running behind a nginx reverse proxy with ssl for a long time with no problems. I do not know where the problem is @posLop :)

VikashKothary commented 2 years ago

Thank you for the information. I'll try and have a look at this issue this weekend.

From the comments, it sounds like setting up a reverse proxy with SSL should've fixed your problem. So I think I'll need to investigate why that is not the case.

Kiskadee-dev commented 2 years ago

@VikashKothary In my case i'm 99% sure i've made a mistake and set it up wrong because i'm not experienced on doing this, but i think in the near future it would be nice to ship it with a docker-compose with the reverse proxy ready to rock

VikashKothary commented 2 years ago

@Kiskadee-dev My hope is to improve the process such that any user, regardless of their technical level, can use these services. So I always appreciate you bringing up issues that you face so we can improve the process for future users.

Regarding the docker-compose comment, I totally agree. Could you create a ticket in our docker repo: https://github.com/ankicommunity/anki-devops-services?

dschilling commented 2 years ago

Looks like a fix is coming for this! https://github.com/ankidroid/Anki-Android/pull/11751 - it says it should land in AnkiDroid 2.16.

liasfurl commented 1 year ago

The fix mentioned is merged but I'm still having the same issue due to http. Not sure why it's not resolved?

dschilling commented 1 year ago

@liasfurl Looks like that fix is marked to be included in the 2.16 milestone, and there are still a few items not yet completed in that milestone. The current version of the app in the Google Play Store is still 2.15.6.

sethidden commented 1 year ago

Can confirm that installing AnkiDroid 2.16-beta2 fixed the issue for me.