Skip to content

Commit

Permalink
Add baseUrl configuration (#219)
Browse files Browse the repository at this point in the history
Co-Authored-By: Reto <brunnre8@users.noreply.github.com>
  • Loading branch information
xPaw and brunnre8 committed Nov 4, 2019
1 parent f2cba0b commit bfc79f0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
22 changes: 22 additions & 0 deletions _guides/reverse-proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ gzip_types application/javascript image/svg+xml text/css text/plain;

If you have [file uploads](/docs/configuration#fileupload) enabled in The Lounge, you may hit an issue when going over nginx's default upload limit, which will result in a 413 (Request Entity Too Large) error. To prevent this from happening, disable or increase [client_max_body_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) variable.

If you have set [`baseUrl`](/docs/configuration#fileupload) option, then you will need to add extra configuration to proxy the upload urls.

If you set the `baseURL` to `https://example.com/folder/` then you need to add `location /folder/` to your nginx configuration:

```nginx
location /folder/ {
proxy_pass http://127.0.0.1:9000/uploads/;
proxy_set_header X-Forwarded-For $remote_addr;
}
```

## [Apache](https://httpd.apache.org/)

Enable the necessary modules `a2enmod rewrite`, `a2enmod proxy`, `a2enmod proxy_http`, and `a2enmod proxy_wstunnel`.
Expand Down Expand Up @@ -106,6 +117,17 @@ proxy / http://127.0.0.1:9000 {
}
```

### File uploads

If you have set [`baseUrl`](/docs/configuration#fileupload) option, then you will need to add extra configuration to proxy the upload urls.

```
proxy /folder/ http://127.0.0.1:9000/uploads {
without /folder
transparent
}
```

## [HAProxy](https://www.haproxy.org/)

```
Expand Down
28 changes: 17 additions & 11 deletions _includes/config.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DO NOT EDIT THIS FILE MANUALLY.
Content for the following is generated by this script in the main repo:
https://github.com/thelounge/thelounge/blob/master/scripts/generate-config-doc.js
Last updated at 2019-01-31 08:01:52 (UTC) by Pavel Djundik
Last updated at 2019-11-01 11:17:13 (UTC) by Pavel Djundik
-->

## Server settings
Expand Down Expand Up @@ -142,6 +142,12 @@ The available keys for the `fileUpload` object are:
this limit will be prompted with an error message in their browser. A value of
`-1` disables the file size limit and allows files of any size. **Use at
your own risk.** This value is set to `10240` kilobytes by default.
- `baseUrl`: If you want change the URL where uploaded files are accessed,
you can set this option to `"https://example.com/folder/"` and the final URL
would look like `"https://example.com/folder/aabbccddeeff1234/name.png"`.
If you use this option, you must have a reverse proxy configured,
to correctly proxy the uploads URLs back to The Lounge.
This value is set to `null` by default.

### `transports`

Expand Down Expand Up @@ -264,23 +270,23 @@ There are 2 ways to configure the `webirc` setting:

```json
webirc: {
"irc.example.net": "password1",
"irc.example.org": "passw0rd",
"irc.example.net": "thisiswebircpassword1",
"irc.example.org": "thisiswebircpassword2",
},
```

- **Advanced**: an object where keys are IRC hosts and values are functions
that take three arguments (`client`, `args`, `trusted`) and return an
object to be directly passed to `irc-framework`. For example:
that take two arguments (`webircObj`, `network`) and return an
object to be directly passed to `irc-framework`. `webircObj` contains the
generated object which you can modify. For example:

```js
webirc: {
"irc.example.net": (client, args, trusted) => ({
username: "thelounge",
password: "password1",
address: args.ip,
hostname: `webirc/${args.hostname}`
}),
"irc.example.com": (webircObj, network) => {
webircObj.password = "thisiswebircpassword";
webircObj.hostname = `webirc/${webircObj.hostname}`;
return webircObj;
},
},
```

Expand Down

0 comments on commit bfc79f0

Please sign in to comment.