Joplin Server Setup - Invalid origin

Host OS: Ubuntu Server 20.04
Joplin Version: 2.0.7
Docker Version: 20.10.7, build f0df350
Docker Compose Version: 1.29.2, build 5becea4c

I'm in the process of rebuilding my home server. Previously I've had Joplin running on my NextCloud instance, but a rebuild seems like the ideal time to move to Joplin Server for sync.

In lieu of finding any other (official?) documentation, I used Setting up a Joplin Server on Docker as a guide on how to configure the server.

Within the directory /usr/share/docker I have the docker-compose.yml from the git repo, and I've modified the .env as per below:

APP_BASE_URL=http://10.1.1.1/joplin # I've tried with http and https
APP_PORT=22300

DB_CLIENT=pg
POSTGRES_PASSWORD=xxxxxx
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin
POSTGRES_PORT=5432
POSTGRES_HOST=localhost

I spin it all up with docker-compose up -d

Then when I point a browser to http://10.1.1.1:22300/joplin or http://10.1.1.1:22300/joplin/login, I get a page that simply says "Invalid origin".

I'd love to be pointed in the right direction, if anyone can advise where I'm misunderstanding.

Thanks in advance.

You need to add the port to the base url.

Thanks @laurent, and an even bigger thank you for such an amazing application. Love your work!

But... still no luck.

.env file

APP_BASE_URL=http://10.1.1.1:22300/joplin
 APP_PORT=22300

 DB_CLIENT=pg
 POSTGRES_PASSWORD=xxxxxxxx
 POSTGRES_DATABASE=joplin
 POSTGRES_USER=joplin
 POSTGRES_PORT=5432
 POSTGRES_HOST=localhost

With the .env as per above (and after running docker-compose restart), I stilll get "Invalid origin" when trying to load up http://10.1.1.1:22300/joplin or /joplin/login

If I make the base url use https I get an SSL name too long error.

An error occurred during a connection to 10.1.1.1:22300. SSL received a record that exceeded the maximum permissible length.

Error code: SSL_ERROR_RX_RECORD_TOO_LONG

I wouldn't expect SSL to work given I haven't configured any certificates. This will only be accessible locally or via VPN - so I'm not worried about SSL for now.

Sorry, anywhere I can look?

I don't need a separate web or webdav server for this, do I?

1 Like

@siege801, I have a similar problem than you. I commented the post from which you got your information ( Setting up a Joplin Server on Docker). I think he did not include steps to create a SSL certificate. I tried to do so as explain in step 6 of Guide for Joplin-Server on Raspberry Pi but it did not change anything for me. I was just able to configure apache with there but not joplin server yet. I think that some conf is needed in /etc/apache2/sites-available/000-default-le-ssl.conf for joplin but this may not have any relation with your problem.

Would you mind sharing your configuration? Maybe I could help

1 Like

Yes, as far as I know, you do! You have to use a web server in front of it with a reverse proxy set up. Maybe take a look at this guide.

1 Like

I don't mind at all!As my knowledge is very deficient, I can easily make mistake! Here are some config:

more docker-compose.yml

version: '3'

services:
    db:
        image: postgres:13.1
        volumes:
            - ./data/postgres:/var/lib/postgresql/data
        ports:
            - "5432:5432"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
            - POSTGRES_USER=${POSTGRES_USER}
            - POSTGRES_DB=${POSTGRES_DATABASE}
    app:
        image: joplin/server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_BASE_URL=${APP_BASE_URL}
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
            - POSTGRES_DATABASE=${POSTGRES_DATABASE}
            - POSTGRES_USER=${POSTGRES_USER}
            - POSTGRES_PORT=${POSTGRES_PORT}
            - POSTGRES_HOST=db

more .env

APP_BASE_URL=https://li171-xxx.members.linode.com/joplin
APP_PORT=22300

DB_CLIENT=pg
POSTGRES_PASSWORD=xxx
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin
POSTGRES_PORT=5432
POSTGRES_HOST=localhost

more /etc/apache2/sites-available/000-default-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName li171-xxx.members.linode.com
ProxyPass "/joplin" https://172.17.0.1:22300
ProxyPassReverse "/joplin" https://172.17.0.1:22300

SSLCertificateFile /etc/letsencrypt/live/li171-144.members.linode.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/li171-144.members.linode.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

ifconfig


br-98413a19758a: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        (....)

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        (....)

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 173.230.131.x  netmask 255.255.255.0  broadcast 173.230.131.255
        (...)
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        (...)

more /etc/hosts

127.0.0.1 localhost li171-xxx.members.linode.com

li171-xxx.members.linode.com is the public hostname.

The ProxyPass and Reverse has to point to http://172.17.0.1:22300, or did you already tried that?

2 Likes

I'm trying now. I got this when trying to open https://li171-x.members.linode.com:22300/joplin/login

Secure Connection Failed

An error occurred during a connection to li171-xxx.members.linode.com:22300. SSL received a record that exceeded the maximum permissible length.

Error code: SSL_ERROR_RX_RECORD_TOO_LONG
(...)

When running systemctl status docker.service, I can see:

965 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 22300 -container-ip 172.18.0.3 -container-port 22300
             └─970 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 22300 -container-ip 172.18.0.3 -container-port 22300

THis made me think that I may modify config so that ProxyPass and Reverse point to http://172.18.0.3:22300, but it did not make any improvement! I really don't understand anything! That's scary!

Well, I found that apache failed to start because proxy modules were not loaded. (I run ```
sudo a2enmod proxy and sudo a2enmod proxy_htt but still no chance. I still get the Error code: SSL_ERROR_RX_RECORD_TOO_LONG.

If you've everything else set up correctly, you have to type the url without :22300 in the browser. Probably thats the cause of the error, because https only works for port 443...the ReverseProxy automatically routes everything from /joplin/ to the specified IP on port 22300.

1 Like

Amazing. It worked. Thank you! I almost became delirious when it happened! Though, for some reason, I didn´t save the correct admin password (automatically generated from bitwarden) and email recovery does not seem to be setup correctly. Email of admin is admin@localhost. I don't have any email server configured. I don't know if there another solution than initialize joplin-server amd don't even know how to initialize joplin-server. I'm tenting to initialize data... Not so simple. I tried by running:
docker-compose down -v --rmi all --remove-orphans
but the postgres database was not deleted. My wild guess is that all datas are in the data directory. I deleted this directory, tried again and it did the job! Finally!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.