From 84f99b1e93c039a6f4c3ee1373b1e53a401f8338 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 5 Feb 2023 16:18:04 +0000 Subject: [PATCH] feat: use separate hostname env variable --- .env.example | 4 ++++ Caddyfile | 2 +- README.md | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index fd7df67..ee1fe20 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,10 @@ MONGODB=mongodb://database # Redis REDIS_URI=redis://redis/ +# Hostname used for Caddy +# This should in most cases match REVOLT_APP_URL +HOSTNAME=http://local.revolt.chat + # URL to where the Revolt app is publicly accessible REVOLT_APP_URL=http://local.revolt.chat diff --git a/Caddyfile b/Caddyfile index 493d3ee..ab856f5 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,4 +1,4 @@ -{$REVOLT_APP_URL} { +{$HOSTNAME} { route /api* { uri strip_prefix /api reverse_proxy http://api:8000 diff --git a/README.md b/README.md index bb38154..19385de 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,31 @@ You will also want to change the protocols to enable HTTPS: + REVOLT_EXTERNAL_WS_URL=wss://my.domain/ws ``` +### Putting Revolt behind another reverse proxy (or on a non-standard port) + +Override the port definitions on `caddy`: + +```yml +# docker-compose.yml +services: + caddy: + ports: + - "1234:80" +``` + +> **Warning** +> This file is not Git ignored, it may be sufficient to use an override file but that will not remove port 80 / 443 allocations. + +Update the hostname used by the web server: + +```diff +# .env +- HOSTNAME=http://local.revolt.chat ++ HOSTNAME=:80 +``` + +You can now reverse proxy to http://localhost:1234. + ### Expose database You can insecurely expose the database by adding a port definition: