I believe I just dealt with a similar if not same bad gateway issue setting up my Vaultwarden instance. In Docker, are you using a custom docker network for the nginx and vaultwarden containers? And in nginx are you using your server’s localhost IP or the vaultwarden container name? For me, I have both nginx and vaultwarden set to a custom docker network and I found that if I was using the container name in the proxy host, I had to set the forward port to 80 in the nginx proxy host to get vaultwarden to load successfully via domain name. If I used the unraid server's local host IP, I could set the port to the default 4743 and it would also successfully load. Container name + 4743 which I initially had led to 502 bad gateway.
So my hypothesis is this is due to using the custom docker network, because in the Docker tab, I see the port mapping for vaultwarden is "172.19.0.4:80/TCP <-> [localhost IP]:4743". And in the Install / Update Container page for vaultwarden, it doesn't seem to allow changing the Container Port from 80, which is what I am guessing is being used by the custom docker network, so that the container name is resolving to the 172 address instead of the server’s local IP. I am still very new to Unraid and I don't have much experience with Docker containers and templates.