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

Reverse proxy: Server not found on desktop #68

Open
ghost opened this issue Jun 1, 2020 · 3 comments
Open

Reverse proxy: Server not found on desktop #68

ghost opened this issue Jun 1, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 1, 2020

I installed anki-sync-server on my personal server, and I set up a reverse proxy with Nginx so that the sync server is served on https://anki.thaega.fr, 443 port. As far as I can tell, it's running correctly server-side.
However, when I try to sync it with Anki Desktop (version 2.1.26), I get the error

Server not found. Either your connection is down, or antivirus/firewall software is blocking Anki from connecting to the internet.

and nothing shows up on the logs server-side.
The content of addons21/ankisyncd/__init__.py are

import anki.sync, anki.hooks, aqt

addr = "https://anki.thaega.fr" # put your server address here
anki.sync.SYNC_BASE = "%s" + addr
def resetHostNum():
    aqt.mw.pm.profile['hostNum'] = None
anki.hooks.addHook("profileLoaded", resetHostNum)

I previously had made the mistake of leaving a trailing slash at the end of the address, which gave me the following error

Traceback (most recent call last):
  File "aqt/sync.py", line 397, in run
  File "aqt/sync.py", line 420, in _sync
  File "anki/sync.py", line 571, in hostKey
  File "json/__init__.py", line 357, in loads
  File "json/decoder.py", line 337, in decode
  File "json/decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

and left some trace in the logs server-side.

I can't log in either using AnkiDroid (without any error messages), however these login attemps do show up on the server logs.

@AntonOfTheWoods
Copy link

Is there some reason you are not using the supplied addon? https://github.com/tsudoko/anki-sync-server/tree/master/addon. It works great for me, though you may have to use a previous version as 2.1.26 needs some extra configuration to get working. I believe 2.1.19 is working with the current state of this repo.

@ghost
Copy link
Author

ghost commented Jun 2, 2020

I followed the instructions provided in the Readme, that made no mention of it. I'm going to try it.
I downgraded Anki to 2.1.15 (because I couldn't find a build for 2.1.19), put the addon files in addons21/ankisyncd.
I now get the response "AnkiWeb ID or password was incorrect", which is an improvement compared to what I was getting before. I see no trace of this request in the logs, which leads me to suppose that Anki somehow didn't get the message that it should use my custom server.
Should I have filled config.json in some way?

@AntonOfTheWoods
Copy link

AntonOfTheWoods commented Jun 2, 2020

Our friend over at https://github.com/kuklinistvan/docker-anki-sync-server has linked to 2.1.19 for various platforms (and provided alternative links if the Anki guys remove the files). Check the Readme there for the links.

The config.json gets filled in when you update the Tools->Preferences->Network page and activate "Use custom server". If memory serves you may have to close and reopen Anki after filling in this for the first time.

Yes, the Readme makes no mention of it, that could be improved.

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

1 participant