Compiler: can`t deal with https_proxy

Created on 14 Nov 2018  Â·  11Comments  Â·  Source: elm/compiler

elm 0.19 ubuntu 18.04
$ export https_proxy=https://proxy.example.org:3128
$ elm init
elm: HttpExceptionContentWrapper {unHttpExceptionContentWrapper = InvalidProxyEnvironmentVariable "https_proxy" "https://proxy.example.org:3128"}
(curl work ok with this env)

Most helpful comment

@sevkin, the elm binary uses the http-client haskell library that supports http_proxy and https_proxy environment variables, see https://haskell-lang.org/library/http-client.

To use https_proxy, you must connect first by http to the proxy, then the connection will be upgraded to https, see https://github.com/commercialhaskell/stack/issues/1165#issuecomment-148368181.

For example:
https_proxy=http://proxy.example.org:3128
or
https_proxy=proxy.example.org:3128

AFAIK connecting to the proxy in https is not supported.

All 11 comments

Try with:

https_proxy=proxy.example.org:3128

@rlefevre incompatible with curl and other tools

Can you provide more context about the root problem?

  1. What are you trying to do in the first place?
  2. What is the behavior you expect?
  3. Are there other languages that have the behavior you expect? Can you give links to docs about that?

I am going to close this since I cannot tell what actions should be taken from the original post. Try to get answers to these questions here or on discourse before opening a new issue.

@evancz the root of problem is here https://zapret.info/index.php?url=package.elm-lang.org but I doubt that I will find an understanding here :(

@sevkin, the elm binary uses the http-client haskell library that supports http_proxy and https_proxy environment variables, see https://haskell-lang.org/library/http-client.

To use https_proxy, you must connect first by http to the proxy, then the connection will be upgraded to https, see https://github.com/commercialhaskell/stack/issues/1165#issuecomment-148368181.

For example:
https_proxy=http://proxy.example.org:3128
or
https_proxy=proxy.example.org:3128

AFAIK connecting to the proxy in https is not supported.

@rlefevre thank you!

Also see https://gist.github.com/rlefevre/7c21513c3cc14ea23524223ab35e4ca6 for unofficial proxies dedicated to Elm.

Unfortunately, this does not work with proxy URLs containing authentication, e.g. http://user:[email protected]:8080--even without the protocol prefix. I wish the Haskell http-client would follow the convention, I was already happy in anticipation of a solution, only to find out that it doesn't work. For sure, this will impact the adoption of Elm in large enterprises that tend to rely on proxies.

@hasko My old comment was wrong and I edited it.

http-client supports adding the protocol, but AFAIK it only supports connecting to the proxy in http, for example:
https_proxy=http://hostname.domain:8080

The connection is upgraded to https after.

According to https://github.com/snoyberg/http-client/issues/132, authentication should also work.
Have you tried: https_proxy=http://user:[email protected]:8080?

@rlefevre you are probably right. After investigating my issue a little further, I discovered that the company I work for apparently silently disabled basic authentication for the proxy. Now they only support NTLM. This makes sense from a security point of view as Basic authentication is a joke anyway, but it has also finally rendered the command line unusable. Maybe we should just close the whole shop to be finally secure. Sigh. It's probably a Christmas gift.

Bottom line, I cannot test if proxies work for Elm but they probably do.

@hasko I believe that stack also uses http-client and according to https://github.com/commercialhaskell/stack/issues/3965, NTLM should work if you don't put the domain name:

Set environment variable HTTPS_PROXY to http://YOURNAME:YOURPASSWORD@YOURPROXY, YOURNAME must not include your Windows domain.

Was this page helpful?
0 / 5 - 0 ratings