This is for anyone experiencing the 502 Bad gateway when importing data into vaultwarden.
I am using swag for reverse proxy. Make sure that you use the vaultwarden container IP address as $upstream_app instead of default (which is the name of the docker).
My mistake was that I only used IP address for "location / {", It is when I scrolled down on that conf file, I realised there are separate section for /admin , /api and /notification as well.
I hope this helps someone.