Obsidian Livesync Self-hosted HTTPS Issue

Categories: Coding

I use Obsidian as my note taking editor of choice. I use the plugin Obsidian Livesync as the plugin I use to sync my notes from my mobile device to my desktop via a remote server. Unfortunately, I realized recently that my notes were not syncing across my devices. I was receiving a mysterious error: Could not connect to http://<my local dns name>:<port>/<table> TypeError:Load failed. Such is the life of maintaining your own tools; if I just used iCloud this would just work.

Alas, instead of moving to a system I don’t control I opted to figure out what the issue was. After looking around at the current Github issues for Livesync I came across one that looked promising: not working on mobile. Looks like someone else was able to fix the issue by setting up their remote server with HTTPS. Apple apparently has recently been pushing apps to use HTTPS across the board and Obsidian (in communication with the Livesync dev) has recently been affected.

I was using http://<IP_ADDRESS> as the URL for my Livesync server. What can I do to fix this?

The plan

So basically what we want to do is have HTTPS traffic get forwarded to our server’s couchdb setup. I use Apache as my webserver. As another user on the Github issue put it we want to make: “Obsidian –> https://couchdb.<YOUR_DOMAIN>.com –> reverse-proxy –> ” (edits mine). Let me walk you through how I did this.

Setting up the domain name

First and simplest, you need to setup a new subdomain. This is done through your domain registrar. Go there and find the advanced DNS settings. Setup an A-name record for your chosen subdomain and point it to your remote server’s IP address. Your registrar should have instructions on how to do this.

Configuring Apache

Apache has some documentation on how to setup a reverse proxy which are fairly good. Basically you’ll want to go into your apache /sites-available and create a new entry for your recently set up subdomain. Something like:

<VirtualHost *:443>
        ServerName <YOUR_SUBDOMAIN>
        ProxyPreserveHost On
        ProxyPass /<DB_NAME> http://<LOCAL_IP>:5984/<DB_NAME>/
        ProxyPassReverse /<DB_NAME> http://<LOCAL_IP>:5984/<DB_NAME>/

Digital ocean has a good article here on the subject which explains most of the directives. Specifically you don’t want to just proxy the root / because when Livesync sends a connection request, it adds the database name to the URL path. For example, if your DB name was livesync and your URL was db.foo.bar you would get sent a request to db.foo.bar/livesync. So you need to proxy along the /livesync part to couchdb.

Getting a certificate

This part was easy using certbot. Honestly just get certbot and read their documentation it was so easy to use.


After that I changed the remote URL on both my Obsidian mobile and desktoip instances and (after some initial debugging) it worked! Getting into the Obsidian inspector provided some useful debugging tips when I was getting confused. Hopefully this post will give you a bit of guidance as well.