Can´t reach localhost API using VPN

When I try to make a postman call to an API instance running localhost using the VPN, I immediately get a 500 error to the postman. On the other hand, when I don’t use VPN, I manage to connect to the API locally, but it can’t connect to the DB because I’m not using VPN. Please, could you help me?