Can I serve paperless-ngx from more than one URL? reddit / selfhosted ---------------------------------------------------------------------- JimmyRecard · 2023-12-26 16:20 Hi. Much like everyone else, I am in awe of paperless-ngx. Love it. Most of my services are only available only locally, and I normally serve them from `home.example.com` so that the final address is `service.home.example.com`. However, I do have a couple of internet facing services which are served from the simple subdomain, such as `service.example.com`. These services use Cloudflare Tunnel. I use this setup mainly so my users know at a glance which services are accessible from local WiFi only; if it has `home` in the URL, it is only accessible from home WiFi (or with the VPN setup). I've setup paperless-ngx on `paperless.home.example.com` and all is well. However, now I also want to expose it to the internet for couple users who often don't use my home WiFi. I've set it up in the Cloudflare console to point to `paperless.example.com` but this does not work. I get a CSRF error because my config is `PAPERLESS_URL=paperless.home.example.com`, which is expected. Looking at the docs, it seemed to me like setting `PAPERLESS_CSRF_TRUSTED_ORIGINS`, `PAPERLESS_ALLOWED_HOSTS`, `PAPERLESS_CORS_ALLOWED_HOSTS` to `paperless.example.com` might help, but that results in `Bad Request (400)` when accessing from that address. Is anyone familiar with any solution that might result with paperless- ngx being accessible from both URLs? Thanks for your help. ---------------------------------------------------------------------- Nintenuendo_ · 2023-12-26 16:33 You're overcomplicating things. Yes you can most definitely serve the service from multiple different web servers at the same time - the magic is in the proxy configuration. If you're using nginx or something, then it's the proxy-conf folder that you create your *.conf files in to setup subdomains. So write your paperless-ngx.subdomain.conf file (example in the github repo), and throw a different conf file on both of the web servers that both point the proxy_pass variable to the same paperless-ngx service. ---------------------------------------------------------------------- joyfulmarvin · 2023-12-26 17:32 Generally you are right, but I remember specifically paperless to be picky with the address. You have to write it in the conf so that the server expects a specific url. Not sure if you can put two different urls in there. I’d suggest a split DNS and use of a single address by two different means - directly in the lan, via cloud flare when outside. ---------------------------------------------------------------------- Nintenuendo_ · 2023-12-26 17:43 So I hear what you are saying, so let me break this down even further now that I'm not on my phone. Paperless wants you to [create 3 files](https://i.imgur.com/aj86Xan.png), docker-compose.env, docker- compose.yml, and a hidden file .env (other folders created after docker-compose up -d) [.env](https://i.imgur.com/ippVAYC.png) consists of nothing more than the project name. The [docker-compose.env](https://i.imgur.com/A6lKnR6.png) file holds all of the variables you want to change for the docker container, all in one file that we're holding off to the side, because it can get a little large if one were to go nuts with the options. This is what I think you were talking about when you said you need to enter a server url, and yeah I'm not too sure if you can add two here, but I hope there is some simple voodoo that can be done. And last but not least, the [docker- compose.yml](https://i.imgur.com/JQTos1Q.png) file to bring it all together. This should be pretty self explanatory, but invokes the other files and launches our services with compose. If you set this up, the exact same way on two different web servers, you'll run into no issues with the address. **edit** - Ohh sorry, and [here's the proxy- conf](https://i.imgur.com/k3NymLT.png) I'm currently using, this is what you want in the NGINX proxy-conf folder. Change any variables to fit. ---------------------------------------------------------------------- JimmyRecard · 2023-12-26 17:58 Maybe I wasn't clear in the OP, if so, I'm sorry, but I don't have multiple web servers. I have one server with one instance of paperless-ngx and it is currently accessible from `paperless.home.example.com` (only on the local network) but I would also, in addition, like for it to be accessible from `paperless.example.com` (publicly on the internet, via Cloudflare Tunnel). That way my existing users who are already setup on the local network can continue using it, while additional users can access it over the internet. ---------------------------------------------------------------------- Nintenuendo_ · 2023-12-26 18:02 Ohh then my other comment [here](https://www.reddit.com/r/selfhosted/s/jp0mDmV9St) is what you need to do. The proxy-conf part ---------------------------------------------------------------------- JimmyRecard · 2023-12-26 18:04 Yeah, I tried specifying two domains in `PAPERLESS_URL` but it just crashed the web server container. DNS is an interesting idea, but if I'm moving to just one URL might as well just route is all via public facing Cloudflare Tunnel domain. I mean, it's clearly suboptimal to send the data out to Cloudflare just so it lands few metres from the sender, but give the small amount of data, might not matter much. I'd still like to preserve this separation between home and public URL, but if I cannot figure it out, might have to concede and go that way. ---------------------------------------------------------------------- revereddesecration · 2023-12-27 08:24 https://docs.paperless-ngx.com/configuration/ I’m looking at it, you don’t need to set any of those. Leave them blank.