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

Ankidroid can't connect to anki-sync-server #58

Open
AdrienLemaire opened this issue Mar 3, 2020 · 7 comments
Open

Ankidroid can't connect to anki-sync-server #58

AdrienLemaire opened this issue Mar 3, 2020 · 7 comments

Comments

@AdrienLemaire
Copy link

AdrienLemaire commented Mar 3, 2020

I've setup anki-sync-server, opened the port 27701 on my router, manage to sync my laptop Anki to the server using the internet ip.
I can also access the server from my android's browser and see the message "Anki Sync Server"
But when I try syncing from the phone, it failed with the following error:

Screenshot_20200303-200008

From the readme:

AnkiDroid
Advanced → Custom sync server

Unless you have set up a reverse proxy to handle encrypted connections, use http as the protocol. The port will be either the default, 27701, or whatever you have specified in ankisyncd.conf (or, if using a reverse proxy, whatever port you configured to accept the front-end connection).

Do not use trailing slashes.

It looks like http isn't supported by default on android
https://better-coding.com/solved-android-cannot-send-data-to-the-server-cleartext-communication-to-not-permitted-by-network-security-policy/

@dobefore
Copy link

Switching back to ankidroid verion 2.9 can solve it

@AntonOfTheWoods
Copy link

Both of those two bits of information are very interesting! Forcing HTTPS is going to be more and more of an issue, no matter how much it annoys some people. Let's Encrypt is getting really easy to use now though, so this should be less of a hassle going forward.

@genedan
Copy link

genedan commented May 17, 2020

I talked to the AnkiDroid guys and from version 2.10+ they want people to switch to SSL:

Screenshot from 2020-05-17 17-55-12

I took a look at #22 and set up my own reverse proxy, which cleared up the clear text issue. There are various ways to do so. I set mine up on AWS with a signed certificate from Let's Encrypt but I believe you might be able to use a self-signed one as well.

@dobefore
Copy link

dobefore commented Jun 2, 2020

It seems Ankidroid (version:2.10.4 )can work without ssl.That is,It can run with http. I tested it just now!

@dobefore
Copy link

For local https mkcert is an easy way to create self-signed CA to allow Ankidroid to sync with https

@vintotal
Copy link

vintotal commented Jun 7, 2021

For local https mkcert is an easy way to create self-signed CA to allow Ankidroid to sync with https

I run it on my PC with the Anki desktop folder, using the command:
mkcert -install
mkcert rootCA

Then I put the rootCA.pem file in my Android 9 phone, install the certificate for VPN/apps in the settings and reboot the phone. I am unable to install the file «rootCA-key.pem». Unfortunetely, this method does not allow me to sync with https. I then downloaded and installed Ankidroid 2.9.

@dobefore Sorry to everyone for digging this problem. Now that Anki desktop has a builtin sync server, is there a way to make Ankidroid sync with it?

If I first upload my Anki Desktop 2.0.52 collection then try to download with Ankidroid 2.9 version using http it says 400: BAD REQUEST. The same happens if I upload with Ankidroid 2.9 and try to download with Anki desktop 2.0.52.

When try with https it does the same as the writer of this issue has posted.

@RetiredWorld
Copy link

I think the network security policy is completely unnecessary.

I run my self-hosted anki-sync-server and have access via WireGuard. That is, with my VPN cert set up, I can guarantee secure connection via http://192.168.2.200:27701.

Having compulsory TLS connection will resulting double cert encrypt & decrypt in my situation. Also, it is inconvenient to obtain a cert for an ip like 192.168.2.200.

I admit TLS should be a must for any public web services. But in my case, I never intend for opening to public, therefore such policy cause trouble to me.

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

6 participants