Joplin Server and Nginx under subresource and HTTPS

I think that the problem lies with the nginx setup and not Joplin as what you are asking for is basically the Joplin Server base path environment variable. It's just that nginx adds to it.

Try this:

In your .env file set APP_BASE_URL=https://myRaspi/joplinServer as well as any other variables.

or forget the .env file and just use the docker-compose file.

version: '3'
services:
    db:
        restart: unless-stopped
        image: postgres:13.1
        ports:
            - "5432:5432"
        volumes:
            - /home/myUser/Docker/joplin-data:/var/lib/postgresql/data
        environment:
            - POSTGRES_PASSWORD=reallySecret
            - POSTGRES_USER=joplin
            - POSTGRES_DB=joplin
    app:
        environment:
            - APP_BASE_URL=https://myRaspi/joplinServer
            - APP_PORT=22300
            - POSTGRES_PASSWORD=reallySecret
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=joplin
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=db
            - DB_CLIENT=pg
        restart: unless-stopped
        image: florider89/joplin-server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"

... and in your nginx server block section for the proxy_pass location add the rewrite instruction (as below):

    # Proxy headers
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;

    location /joplinServer/ {
       proxy_redirect off;
       rewrite     ^/joplinServer/(.*)$ /$1 break;
       proxy_pass http://127.0.0.1:22300;
    }

The trailing slashes after joplinServer in the server block location section appear to be important.

When I do that on my test system if I type just the url without /joplinServer I get sent to the default nginx welcome page. However if I add /joplinServer I get sent to the server login page.

server_login

I will let you test if you can still sync with this server after all this abuse!!

2 Likes