I am using Ubuntu behind a (Windows) proxy. I would like to use the cabal utility.

jem@Respect:~$ cabal update
Config file path source is default config file.
Config file /home/jem/.cabal/config not found.
Writing default configuration to /home/jem/.cabal/config
Downloading the latest package list from hackage.haskell.org
Warning: invalid http proxy uri:
Warning: proxy uri must be http with a hostname
Warning: ignoring http proxy, trying a direct connection

The proxy URL has been read from the environment. My proxy requires authentication, but cabal wants the proxy URL to start with a hostname, so perhaps it will prompt me for credentials...

jem@Respect:~$ http_proxy=http://internetproxy:3128/ cabal update
Downloading the latest package list from hackage.haskell.org
No action for prompting/generating user+password credentials  provided (use: setAuthorityGen); returning Nothing
cabal: Failed to download index 'ErrorMisc "Unsucessful HTTP code: (4,0,7)"'

What is setAuthorityGen and how do I use it? More importantly, can I enable access via the authenticating proxy? Will I need to tunnel?


3 Answers 3


My standard approach to ISA proxies is to configure a local authenticating proxy like cntlm. After installing cntlm on your Ubuntu machine, you configure it to authenticate via NTLM at the ISA proxy with your Windows username and password. Then you set the HTTP_PROXY variable to http://localhost:3128 (i.e. the port that cntlm is listening to).

The advantage of this approach is that only one program has to deal with the Windows proxy. All other programs can pass through by using cntlm as their gateway.


Answer from Haskell-cafe pipermail

cabal-install is configured in ~/.cabal/config. Add this line to the config file:

export http_proxy=http://${username}:${password}@${proxy_address}

I have got it working with polipo. My university uses http-proxy with authentication. In /etc/polipo/config you need to add these lines

parentProxy = "proxy.server.com:80"
parentAuthCredentials = "myusername:mypassword"

And export http_proxy=http://localhost:8123". And it worked like a charm.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .