Hi all,
if anyone si facing issue with AIO NextCloud proxied through SWAG and recieving 502 Bad Gateway error hope this helps you out.
TLDR
use IP instead of name, check correct port, use http instead https
set $upstream_app YourServerIPHere;
set $upstream_port 11000;
set $upstream_proto http;
Long version:
My setup:
HP mini PC at home with Unraid server and AIO Nextcloud docker. All that behind double NAT from ISP so no chance of port forwarding
Remote VPS (Strato.de minimal package with unlimited bandwith for 1 EUR/month) running ubuntu and SWAG
VPS is connected with home unraid server using Tailscale plugin.
Using Cloud flare DNS with my own domain.com pointed to VPS with SWAG running.
(Mostly inspired by SpaceInvader One YouTube 3 part setup for Tailscale that also includes SWAG setup in part 3)
Worked liked charm with minal setup for Immich, Jellyfin etc finally no issues caused by cloudflare tunnel max file limits
Tried to get AIO Nextcloud running in same way.
I prepared A type "nextcloud" entry in CloudFlare DNS to point to my VPS. On VPS added config entry with the correct IP, installed docker app, but when I was trying to proceed from localhost setup pages I got 502 error instead of forward through my nextcloud.mydomain.com .
The issue was in the SWAG config in nextcloud, I changed following lines:
FROM:
set $upstream_app nextcloud;
set $upstream_port 443;
set $upstream_proto https;
TO:
set $upstream_app Your.Server.IP.Here;
set $upstream_port 11000;
set $upstream_proto http;
Hope it helps someone. Happy to share as unraid newbie.