fraction / oasis

Free, open-source, peer-to-peer social application that helps you follow friends and discover new ones on Secure Scuttlebutt (SSB).
http://oasis-demo.fraction.io
GNU Affero General Public License v3.0
287 stars 42 forks source link

allow-host parameter is not read from config file #743

Closed mplorentz closed 2 years ago

mplorentz commented 3 years ago

What's the problem you want solved?

I'd like to host v2.17.0 in Docker behind a Traefik reverse proxy.

Is there a solution you'd like to recommend?

I think maybe there was a regression between 58765f8 and v2.17.0. I'd like oasis to read the allow-host parameter in my config file.

Details

I recently upgraded from 58765f8 (between v2.16.0 and v2.17.0) to v2.17.0. After upgrading, the allow-host parameter in default.json no longer appears to be working. Here is my default.json:

{
   "allow-host": "oasis.lorentz.is",
   "open": false,
   "debug": true
}

But when I run the container it prints this:

oasis_1  | 2021-08-05T14:32:48.405Z oasis Configuration read defaults from /home/node/.config/oasis/default.json
oasis_1  | 2021-08-05T14:32:48.409Z oasis Current configuration: {
oasis_1  |   host: '0.0.0.0',
oasis_1  |   'allow-host': 'localhost',
oasis_1  |   allowHost: 'localhost',
oasis_1  |   open: false,
oasis_1  |   offline: false,
oasis_1  |   port: 3000,
oasis_1  |   public: false,
oasis_1  |   debug: true,
oasis_1  |   theme: 'atelier-sulphurpool-light'
oasis_1  | }

You can see that it is reading my default.json because it has set debug: true, but allow-host is set to localhost not oasis.lorentz.is.

If I try to access the container through my web browser I get the following error (which allow-host is supposed to solve):

oasis_1  | Invalid HTTP hostname: oasis.lorentz.is
oasis_1  | BadRequestError: Request must be addressed to localhost or 0.0.0.0 and non-GET requests must contain non-blob referer.
oasis_1  |     at Object.assert (/home/node/app/node_modules/http-assert/index.js:8:9)
oasis_1  |     at /home/node/app/src/http.js:107:9
oasis_1  |     at dispatch (/home/node/app/node_modules/koa-compose/index.js:42:32)
oasis_1  |     at /home/node/app/node_modules/koa-mount/index.js:52:32
oasis_1  |     at dispatch (/home/node/app/node_modules/koa-compose/index.js:42:32)
oasis_1  |     at /home/node/app/node_modules/koa-compose/index.js:34:12
oasis_1  |     at Application.handleRequest (/home/node/app/node_modules/koa/lib/application.js:168:12)
oasis_1  |     at Server.handleRequest (/home/node/app/node_modules/koa/lib/application.js:150:19)
oasis_1  |     at Server.emit (events.js:375:28)
oasis_1  |     at parserOnIncoming (_http_server.js:897:12)
oasis_1  | Invalid HTTP hostname: oasis.lorentz.is

I looked through the docs and it doesn't look like this parameter's behavior has changed. Is this a regression or is there some other way to allow hosts now?

mplorentz commented 2 years ago

I think the problem was that the Dockerfile was overwriting these values in its CMD. I patched this in a fork here: https://github.com/planetary-social/oasis/commit/38dca1203991b20fb8836e2b03ca9f262eb1f69d

Since this repo is no longer maintained I'm going to close this issue.