Skip to content

Invoke-WebRequest and Invoke-RestMethod should honor HTTP_Proxy and HTTPS_proxy env vars #3112

Closed

Description

@SteveL-MSFT

The Unix way to specify proxy seems to be via HTTP_Proxy and HTTPS_Proxy env vars

Activity

  1. added this to the milestone on Feb 8, 2017
  2. cawoodm commented on Feb 9, 2017

    @cawoodm

    The Windows way is to honour the system proxy in control panel -> internet options -> connections -> LAN settings.

  3. SteveL-MSFT commented on Feb 9, 2017

    @SteveL-MSFT
    MemberAuthor

    The Windows way should already been honored by .Net on Windows

  4. joeyaiello commented on Feb 9, 2017

    @joeyaiello
    Contributor

    Steve Lee (@SteveL-MSFT) Shouldn't the *nix way be honored by .NET as well?

  5. added
    Area-Maintainers-Documentation
    and removed
    WG-Cmdlets
    on Feb 9, 2017
  6. SteveL-MSFT commented on Feb 9, 2017

    @SteveL-MSFT
    MemberAuthor

    Joey Aiello (@joeyaiello) yes, looks like CoreFx supports whatever libcurl supports (https://github.com/dotnet/corefx/issues/11757) so we may just need to also document this

  7. cawoodm commented on Feb 9, 2017

    @cawoodm

    Invoke-RestMethod was not using my system proxy today (PS5, Win7) I had to use the -Proxy parameter.

  8. SteveL-MSFT commented on Feb 10, 2017

    @SteveL-MSFT
    MemberAuthor

    As far as I can tell, the web cmdlets never used the system proxy on Windows so having them suddenly start using the system proxy would be a breaking change. Need someone to do a bit more research on this so we don't have a breaking change.

  9. cawoodm commented on Feb 10, 2017

    @cawoodm

    If you have a system proxy (or, more likely a .pac) then all your internet traffic is going through those rules anyway. That is, according to the .pac, it will use a proxy or not as appropriate. To be clear: when I say PowerShell should respect the proxy I don't mean it should use a fixed proxy host, it should respect how the system is configured to use, or not, a proxy. Used properly, I can't see how it would break things: anything you can't access by respecting the proxy, you can't access in Chrome, IE etc.

  10. tibmeister commented on Feb 16, 2017

    @tibmeister

    Ran into a similar issue and ended up defining $env:HTTP_PROXY and $env:HTTPS_PROXY with the URL of http://:@:. This seems to be a quick workaround, at least on my CentOS test box.

  11. modified the milestones: 6.0.0-beta1, on Mar 16, 2017
  12. 8 remaining items

  13. added this to the milestone on May 15, 2017
  14. jakara commented on May 3, 2018

    @jakara

    as native curl and wget is coming to windows, I dont see the behavior of iwr will be changed at all:
    curl an wget will honor the unix way, am I right?

  15. markekraus commented on May 3, 2018

    @markekraus
    Contributor

    jie.f (@jakara) I will consider possibly adding support for this in iwr and irm for the 6.2.0 release, it's a bit too late in the cycle for 6.1.0.

    In the mean time this is a kind of work around that works cross platform:

    $PSDefaultParameterValues["invoke-webrequest:proxy"] = $env:http_proxy

    Add that to your profile or in the initialization of your scripts.

  16. jakara commented on May 9, 2018

    @jakara
  17. mklement0 commented on Oct 16, 2018

    @mklement0
    Contributor

    Just to clarify, given that the variable names in this issue's title used mixed case: on Unix-like platforms, where case matters, these variables are commonly lowercase (http_proxy, https_proxy).

  18. iSazonov commented on Jul 16, 2020

    @iSazonov
    Collaborator

    This was implemented in .Net 3+ in new HttpClient.

  19. iSazonov commented on Jul 16, 2020

    @iSazonov
    Collaborator

    Sean Wheeler (@sdwheeler) Was this already documented for the web cmdlets?

  20. sdwheeler commented on Jul 16, 2020

    @sdwheeler
    Contributor

    Ilya (@iSazonov) Yes, this is documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Maintainers-DocumentationResolution-FixedWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions