I tried exporting into http_proxy and https_proxy but that didn't seem to work.
I am guessing that there is another way to use a proxy when querying whois information from the command line?
The whois command talks in a specific protocol and port, namely
whois 43/tcp ; so obviously trying to use an HTTP(S) (HTTP port 80/tcp and HTTPS 443/tcp by default).
So HTTP proxies-aware won't work, as those protocols are not involved with the inner workings of the whois protocol.
If you need to setup an external proxy, you would need a socks aware proxy, as this example https://stackoverflow.com/questions/6718836/how-can-i-implement-a-simple-whois-proxy-in-perl
see also About the WHOIS Protocol
The WHOIS protocol is a simple, plaintext-based protocol that listens on TCP port 43. There is an RFC that defines the protocol, RFC 3912.