# Suggestions http proxy setting for win\_get\_url

**URL:** <https://forum.ansible.com/t/suggestions-http-proxy-setting-for-win-get-url/19134>\
**Category:** Ansible Developer\
**Created:** [August 28, 2015, 2:55am UTC](https://forum.ansible.com/t/suggestions-http-proxy-setting-for-win-get-url/19134 "2015-08-28T02:55:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takeshi\_Kuramochi](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@Takeshi\_Kuramochi](https://forum.ansible.com/u/Takeshi_Kuramochi)\
**Post date:** [August 28, 2015, 2:55am UTC](https://forum.ansible.com/t/suggestions-http-proxy-setting-for-win-get-url/19134/1 "2015-08-28T02:55:18Z")

</div>

Hello,

I think that some enterprise user make have an authentication http proxy when they use win\_get\_url module.  
It is useful to get this module has parameter for these.

For example playbook;

- name: Grab download file  
tags: pscx

win\_get\_url:  
url: ‘[https://example.com/download-file.jpg](https://example.com/download-file.jpg)’  
proxy\_url: ‘[http://10.0.0.1:8080](http://10.0.0.1:8080)’  
user: ‘username’  
pass: ‘password’  
dest: ‘/tmp/download-file.jpg’

For example win\_get\_url.ps1 for v2.0.0-0.1;

---

<div class="post-metadata">

**Author:** ![Takeshi\_Kuramochi](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@Takeshi\_Kuramochi](https://forum.ansible.com/u/Takeshi_Kuramochi)\
**Post date:** [August 28, 2015, 3:09am UTC](https://forum.ansible.com/t/suggestions-http-proxy-setting-for-win-get-url/19134/2 "2015-08-28T03:09:58Z")

</div>

Sorry, I have a error.

Edit example of win\_get\_url.ps1;

— win\_get\_url.ps1 2015-08-28 03:05:01.184000479 +0000  
+++ org\_win\_get\_url.ps1 2015-08-28 00:15:10.000000000 +0000  
@@ -44,15 +44,6 @@ $force = Get-Attr -obj $params -name "fo

If ($force -or -not (Test-Path $dest)) {  
$client = New-Object System.Net.WebClient

- if($params.proxy\_url) {
- $proxy\_url = $params.proxy\_url
- $user = $params.user
- $pass = $params.pass
- $proxy\_server = New-Object System.Net.WebProxy($proxy\_url, $true)
- $credential = New-Object System.Net.NetworkCredential($user, $pass)
- $proxy\_server.Credentials = $credential
- $client.Proxy = $proxy\_server
- }

Try {  
$client.DownloadFile($url, $dest)

2015年8月28日金曜日 11時55分18秒 UTC+9 Takeshi Kuramochi:
