Using an Ubuntu 18.04 vps for this.
Dockered Joplin with the latest release (2.9.1)
Nginx as a reverse Proxy.
Docker compose up works fine, I get the login page but when trying to login with admin@localhost I get the error: Invalid URL.
Sync in the desktop app with the default login credentials work! Ofc I dont want to use them though.
The Error in the log:
2022-08-04 06:40:30: [error] App: Middleware error on /login: TypeError: Invalid URL
app_1 | at new NodeError (node:internal/errors:371:5)
app_1 | at onParseError (node:internal/url:552:9)
app_1 | at new URL (node:internal/url:628:5)
app_1 | at acceptOrigin (/home/joplin/packages/server/src/app.ts:122:21)
app_1 | at Object.origin (/home/joplin/packages/server/src/app.ts:189:8)
app_1 | at cors (/home/joplin/packages/server/node_modules/@koa/cors/index.js:60:24)
app_1 | at dispatch (/home/joplin/packages/server/node_modules/koa-compose/index.js:42:32)
app_1 | at /home/joplin/packages/server/src/app.ts:181:10
app_1 | at Generator.next (<anonymous>)
app_1 | at /home/joplin/packages/server/dist/app.js:8:71 {
app_1 | input: 'null',
app_1 | code: 'ERR_INVALID_URL'
app_1 | }
Following Config files were used:
docker-compose.yml:
Thank you for your help. I tried your Ideas, as you can see in the config below. Still the error persists. It would be great if u could diff your version with mine.
Also, in your .env your APP_BASE_URL should look like this: APP_BASE_URL=https://joplin.example.com (your actual url should be the way it is, the point is the format of the parameter, for instance, no / at the end).
This is my actual setup my Joplin Server works from day 1.
Thanks for the fast reply. I structured my conf file as you did but I still have the same error. Even just clicking login, without any info in the login fields results in the invalid url error. Maybe it is not the nginx causing the problem (seeing the logs of running the docker with the error presented there)
app_1 | 2022-08-05 11:28:12: [error] App: Middleware error on /login: TypeError: Invalid URL
app_1 | at new NodeError (node:internal/errors:371:5)
app_1 | at onParseError (node:internal/url:552:9)
app_1 | at new URL (node:internal/url:628:5)
app_1 | at acceptOrigin (/home/joplin/packages/server/src/app.ts:122:21)
app_1 | at Object.origin (/home/joplin/packages/server/src/app.ts:189:8)
app_1 | at cors (/home/joplin/packages/server/node_modules/@koa/cors/index.js:60:24)
app_1 | at dispatch (/home/joplin/packages/server/node_modules/koa-compose/index.js:42:32)
app_1 | at /home/joplin/packages/server/src/app.ts:181:10
app_1 | at Generator.next (<anonymous>)
app_1 | at /home/joplin/packages/server/dist/app.js:8:71 {
app_1 | input: 'null',
app_1 | code: 'ERR_INVALID_URL'
app_1 | }
At this point I'm sure it's not the fault of Nginx. Although I don't know your setup, the fact that you're looking at Node logs tells me you're up to no good.
Kidding aside, you shouldn't/wouldn't have to do that. Joplin Server is a deployed via a simple docker compose file and the environment file, other than that a reverse proxy config is required. If you did something else/not like this, the problem lies there.
I would advise deleting your current setup and redeploy it as it is "meant to be deployed".
I did and reinstalled everything (easy to do) and the error persists. The log is just the print out by starting docker-compose up without the detached parameter. Maybe someone else has an idea?
If you have a publicly available server where you want to set this up and give me an account I gladly take a look (and have done for quite a few other members on this forum, as well).
Thank you for the offer, but I cant let you do that unfortunately. I run several other services/pages on that server and cant let someone else on there.
I found this issue on github which is prty much my issue. The "workaround" that was suggested is:
"RequestHeader set Origin "https://" early" but I cant make sense of that. Can someone make the solution a little clearer for me?
This is an Apache directive that doesn't translate directly to Nginx. Something similar can be achieved by using the HTTP headers module in Nginx. You need to at this to the config (to the server block), thus enabling CORS:
add_header Access-Control-Allow-Origin *;
Though this is curious why anyone ould need this workaround. I've set up JS for folks with pretty diverse environments, always with Nginx and never needed anything like that.
Edit: another one, from here: Major breaking change in coming Joplin Server 2.0 - #115 by BoxingOctopus (from comment 109). I suspect the URL in your .env doesn't look like it was supposed to (e.g http:// instead of https://). Frankly, if it's not https you should just copy your original nginx config back (or mine, for that matter), change it to https then rebuild it and it will work.