Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can`t deal with https_proxy #1840

Closed
sevkin opened this issue Nov 13, 2018 · 11 comments
Closed

can`t deal with https_proxy #1840

sevkin opened this issue Nov 13, 2018 · 11 comments

Comments

@sevkin
Copy link

sevkin commented Nov 13, 2018

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)

@rlefevre
Copy link
Member

Try with:

https_proxy=proxy.example.org:3128

@sevkin
Copy link
Author

sevkin commented Nov 18, 2018

@rlefevre incompatible with curl and other tools

@evancz
Copy link
Member

evancz commented Nov 19, 2018

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 evancz closed this as completed Nov 19, 2018
@sevkin
Copy link
Author

sevkin commented Nov 20, 2018

@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 :(

@rlefevre
Copy link
Member

rlefevre commented Nov 20, 2018

@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 commercialhaskell/stack#1165 (comment).

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.

@sevkin
Copy link
Author

sevkin commented Nov 20, 2018

@rlefevre thank you!

@rlefevre
Copy link
Member

rlefevre commented Apr 1, 2019

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

@hasko
Copy link

hasko commented Jan 8, 2020

Unfortunately, this does not work with proxy URLs containing authentication, e.g. http://user:pass@hostname.domain: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.

@rlefevre
Copy link
Member

rlefevre commented Jan 8, 2020

@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 snoyberg/http-client#132, authentication should also work.
Have you tried: https_proxy=http://user:pass@hostname.domain:8080?

@hasko
Copy link

hasko commented Jan 9, 2020

@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.

@rlefevre
Copy link
Member

rlefevre commented Jan 9, 2020

@hasko I believe that stack also uses http-client and according to commercialhaskell/stack#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants